user3899634
user3899634

Reputation: 13

how to ignore rewriting css file with .htaccess

I created .htaccess file:

RewriteRule     ^([a-zA-Z]{0,2})/(.*)/(.*)$     index.php?lang=$1&ctrl=$2&method=$3 [L]
RewriteRule     ^([a-zA-Z]{0,2})/(.*)$          index.php?lang=$1&ctrl=$2 [L]
RewriteRule     ^(.*)/(.*)$                     index.php?ctrl=$1&method=$2 [L]

RewriteCond     %{QUERY_STRING}                 !ctrl
RewriteRule     ^(.*)/?$                        index.php?ctrl=$1 [L]

and I need it to ignore rewriting included css files.

Thank's for you answer :)

Upvotes: 1

Views: 154

Answers (2)

anubhava
anubhava

Reputation: 785316

Keep your rules like this:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^([a-zA-Z]{0,2})/([^/]+)/([^/]+)/?$ index.php?lang=$1&ctrl=$2&method=$3 [L,QSA]
RewriteRule ^([a-zA-Z]{0,2})/(.*)$ index.php?lang=$1&ctrl=$2 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?ctrl=$1&method=$2 [L,QSA]

RewriteCond %{QUERY_STRING} !ctrl
RewriteRule ^([^/]+)/?$ index.php?ctrl=$1 [L,QSA]

Upvotes: 1

Bill Criswell
Bill Criswell

Reputation: 32921

You can do this before your other lines I believe.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

Here's a tiny bit more information on it: https://stackoverflow.com/questions/15879029/don%C2%B4t-understand-rewritecond-request-filename-f-and-d

Upvotes: 1

Related Questions