We have this RedirectMatch rule to move clients on the SSL enabled site while maintaining the path they're trying to access:
Redirectmatch permanent (.*) https://www.foobar.com$1
and it is working perfectly. Now we would like to add an exception for /somepath that should not be redirected. How can I do that?
With mod_rewrite I would add a rewriterule saying "don't rewrite and stop matching", but there isn't such mechanism with redirect. Also, if I trivially reverse the regexp like !(/somepath|/someotherpath) it would no longer get the $1 parameter.
-
Any reason you don't want to use mod_rewrite?
You could mimic the functionality with this:
RewriteCond %{REQUEST_URI} !^/(somepath|someotherpath) RewriteRule (.*) $1 [R=permanent] RewriteRule http://%{SERVER_NAME}(.*) https://www.foobar.com$1 [L]
I hadn't realized Apache uses PCRE. Since it does, you can do this bit of voodoo to do what you want with mod_alias:
RedirectMatch permanent ^/?((?!(thisisfoo|thisisbar)).*) https://www.foobar.com/$1
where /thisisfoo and /thisisbar are exceptions to the redirect.
From mark
0 comments:
Post a Comment