TH1981
TH1981

Reputation: 3193

How do I make an exception to a mod rewrite rule?

I absolutely do not understand mod rewrite or the syntax to make it work. I have however managed to cobble together the following, which works exactly as I need it to on my site:

RewriteRule ^page/([^/\.]+)/?$ page.php?page=$1 [L]

it changes www.mysite.com/one into www.mysite.com/page.php?page=one

wonderful.

However, is there a way that I can add an exception to the rule, so that if I try to use the url www.mysite.com/feed for example, it will go to www.mysite.com/feed/index.php rather than trying to redirect to www.mysite.com/page.php?page=feed

Thanks in advance!!

Upvotes: 0

Views: 165

Answers (1)

vitch
vitch

Reputation: 3214

There are a couple of ways you could do this. Probably best would be to add a RewriteCond above the RewriteRule. Something like this (untested):

RewriteCond !^feed
RewriteRule ^page/([^/\.]+)/?$ page.php?page=$1 [L]

If you can't get that to work then you could also put a different RewriteRule above your one to redirect before this rule is matched...

Upvotes: 1

Related Questions