Nick
Nick

Reputation: 16105

Redirect all requests but one

I wonder how to redirect all requests like

foobar.com/cat
foobar.com/cat/1
foobar.com/etc

to

foobar.com/index.php

But not to affect

foobar.com/webmaster/

I don`t want foobar.com/webmaster/ to redirect to index.php. I want it default behavior

How to do that with mod_rewrite?

Upvotes: 2

Views: 197

Answers (2)

AabinGunz
AabinGunz

Reputation: 12347

try this foobar.com/(?!webmaster)[\w\/\d\_\-\:\;\?\=\.]+ as your regular expression to match all other except foobar.com/webmaster/

Apply this regex to select all except foobar.com/webmaster/ and match with

foobar.com/cat
foobar.com/cat/1
foobar.com/etc

add replace with

foobar.com/index.php

Upvotes: 1

akond
akond

Reputation: 16060

RewriteEngine on

RewriteRule ^webmaster/ - [QSA,L]
RewriteRule .* index.php [QSA,L]

Upvotes: 2

Related Questions