Mike
Mike

Reputation: 161

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

RewriteCond %{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

Upvotes: 1

Views: 869

Answers (1)

cori
cori

Reputation: 8810

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....

Upvotes: 0

Related Questions