Forum Moderators: phranque
I have the following rules
RewriteRule ^/some_directory/some_file(.*)$ http://www.example.com/some_directory/some_file.php [L,R=301]
RewriteCond $1 !^a_directory
RewriteCond $1 !^another_directory
RewriteRule ^(.*)$ http://www.example.com [L,R=301]
My problem is the first rule is not working. The url http://www.example.com/some_directory/some_file is redirecting to the home page.
I was under the impression that the first rule would be executed and then no other rules would be followed after that with [L] flag?
So, I want the first rule followed and then stop looking at any other rules.
Thanks,
[edited by: jdMorgan at 10:23 pm (utc) on Jan. 28, 2008]
[edit reason] example.com [/edit]
[added] Also note that parentheses are not required in your first rule, and that your second rule should have a trailing slash on the substitution URL in order to prevent a second redirect occurring as a result of the action of mod_dir. [/added]
Jim
[edited by: jdMorgan at 10:25 pm (utc) on Jan. 28, 2008]
I'm having a problem with this code now in .htaccess
RewriteCond $1!^customers
RewriteCond $1!^crons
RewriteCond $1!^fulfillment
RewriteCond $1!^cgi-bin
RewriteCond $1!^CommConfig
RewriteCond $1!^affiliates
RewriteRule ^(.*)$ [mydomain.com...] [L,R=301]
Only the first conditional statement is being followed. Trying to access any of the directories past the first conditional statement redirects me to mydomain.com.