redirect all EXCEPT one directory


redirect all EXCEPT one directory

Postby phpbutcher » Wed Dec 23, 2009 3:33 pm

Hi all,

I'm doing a site that I used some borrowed mod rewrite rules to redirect everything to the index page in the root. Now I'm being informed that the client has a directory in the root that they use for another application. I know this should be a simple thing, but I have been unable to solve it. I have tried putting another rewrite condition and rewrite rule at the top of my htacces to address just that directory, but it didn't handle it as I expected.

Here's what I started with to redirect everything to the index.php in the root.
Code: Select all
RewriteEngine on
RewriteCond %{QUERY_STRING} .+
RewriteRule .* index.php
RewriteCond %{REQUEST_URI} !~
RewriteRule !(\.sgs|.gif|\.jpg|\.jpeg|\.png|\.swf|\.xml|\.mp3|\.js|\.css|\.ico|\.pdf|\.bob)$  index.php [NC]

I added this as the first condition and rule thinking that it would handle anything going to the /test directory but it didn't.

Code: Select all
RewriteCond  %{HTTP_HOST}/test/%{REQUEST_FILENAME} -f
RewriteRule  ^(.+) /test/$1  [L]

Thanks in advance.
Posts: 1
Joined: Wed Dec 23, 2009 3:05 pm

Return to New Threads/Problems

Who is online

Users browsing this forum: No registered users and 0 guests