Monday, May 21, 2012

Redirect all pages except some folders

I want to redirect all links except few folders
www.example.com www.example.com/foo should be redirected, but

www.example.com/bar should not be redirected.



RewriteCond %{HTTP_HOST}    ^(.*)(example|example1)\.com$
RewriteCond %{REQUEST_URI} !^/bar(.*)$
RewriteCond %{REQUEST_URI} !^(.*)(sitedown.html)(.*)$
RewriteRule ^(.*)$ http://www.example.com/sitedown.html [R=307,L]


I tried with above lines in my virtual hosts file (httpd-vhosts.conf) but these are not working.
I get redirected to sitedown.html for all links.





No comments:

Post a Comment