mod_rewrite rule for all urls except ones with some words
- by zlog
How do I write a mod_rewrite regulare expression rule that is the opposite of this:
^(.+)/path/(page1|page2)+$
ie, I want all pages except blah/path/page1 and blah/path/page2 to redirect to another path, where the x in blah/path/x is used in the new path.
For example, I'd like write a rewrite rule like:
RewriteRule some_regex /index.php?path/show/$1 [L]
where some_regex would pull out the last component of a url in the format:
/something/path/some_param
to redirect to
/index.php/path/show/some_param
I'm trying to use ! and [^] syntax, but I don't quite understand how these work, especially when they involve words not single characters.