Page 1 of 1

mod_rewrite

Posted: Wed Feb 27, 2008 8:18 am
by someberry
(Wasn't sure where to post this, if you think it is better suited in the regex forum then feel free to move :))

Hi, got a wee mod_rewrite problem.

I want to route all requests to a site through index.php. The mod_rewrite I have is:

Code: Select all

RewriteEngine On
RewriteRule ^[^plugin|Public|template].*?     index.php [L]
As you can (hopefully) see from the above, I only want to route requests which aren't in the parent directory of plugin, Public, or template. But for some reason it isn't working! It works for some pages, but for ones like 'example.org/error' and 'example.org/test' it doesn't work.

Any ideas?
Thanks :)

Re: mod_rewrite

Posted: Wed Feb 27, 2008 11:07 am
by Christopher
I think you want to use (plugin|Public|template) instead.

Re: mod_rewrite

Posted: Wed Feb 27, 2008 11:55 am
by someberry
Thanks, the below works great :)

Code: Select all

RewriteRule ^(?!plugin|Public|template).*?     index.php [L]