PDA

View Full Version : htaccess redirect all but one subdirectory?



siguie
09-30-2008, 04:19 AM
Presently I redirect all requests from an addon domain to a new one using ...

RewriteEngine on
Redirect 301 / http://www.OTHER_DOMAIN.com/

... this works great BUT now I would like to allow access to one specific subdirectory in the addon domain ... I thought I could use "RewriteCond" to make an exception but apparently I suck at writing htaccess code. :rolleyes:

So any help would be much appreciated :)

areidmtm
09-30-2008, 03:24 PM
How about...


RewriteEngine on
RewriteCond %{REQUEST_URI} !^/sub_directory/
Redirect 301 / http://www.other_domain.com/

siguie
09-30-2008, 04:50 PM
How about...


RewriteEngine on
RewriteCond %{REQUEST_URI} !^/sub_directory/
Redirect 301 / http://www.other_domain.com/


Shoot that's what I tried but it's not working :confused:

I even thought it might be a browser cache issue but everything still gets redirected to the "other_domain"

Thank you for responding! :)

I'm starting to think there is some addon redirect override that I'm missing :confused:

wysiwyg
09-30-2008, 10:43 PM
It doesn't work because rewritecond defines conditions for rewriterule.

You should be able to do something like this though..
RewriteRule !^subdir(/?|/.*)$ http://example.com