htaccess regex wildcard redirects overriding other redirects
I currently have the following redirects in htaccess, and I need to add two new redirects. Though it appears the last wildcard redirect is overriding the two new redirects which I am trying to add. How do I correct this? Any suggestions? Thank you.
RewriteEngine On
Rewri开发者_JAVA技巧teCond %{HTTP_HOST} ^mydomain.com
RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
RewriteRule ^.*.(jpe?g|gif|png|bmp|ico|swf|gz|xml|htm?l|pem|txt)$ - [L]
RewriteCond %{SCRIPT_FILENAME} !^apanel/*
RewriteRule ^(.*) process.php [L]
And the new redirects I am trying to add are as follows:
RewriteRule ^cs/(.*.css) /shared.php?type=css&files=$1
RewriteRule ^jscript/(.*.js) /shared.php?type=js&files=$1
Well as I read it your last RewriteCond/RewriteRule says "if the filename isn't in the 'apanel' folder redirect it to process.php and stop". Both of your new rules would match that rule first and mod_rewrite would stop processing further directives.
If you put your two new rules above your last Cond/Rule combo and use the [L] flag they should work properly....
精彩评论