how to ignore rewriting css file with .htaccess


Tags: css,apache,.htaccess,mod-rewrite

Problem :

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 :)



Solution :

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]

    CSS Howto..

    How to only have margin between child and not with parent in CSS?

    How to set keyboard focus to a representing parent element of a list

    How to fix this arrow shape created using CSS in IE9

    How can I hide page elements till an AJAX call completes?

    How can I remove the generic HTML/CSS tooltip? [duplicate]

    How do I add two buttons side by side that are made up of an image?

    Show text-decoration when hover over div

    How can I compile LESS files that @import other LESS files?

    how to make an empty span collapse

    How to create such layout in CSS?

    How to create a border that fully covers the adjacent corners in CSS?

    How to style unordered lists in CSS as comma separated text

    How to prevent css missing when exporting some html to excel file?

    How to make a HTML NavBar [closed]

    HTML/CSS — How to add a selected state

    Why my tabs (i.e HOME, ABOUT ME..) doesn't show the corresponding paragraph or section?

    How can one pass component property values to the css/less clientlibs for that component? AEM 6.2

    How do you right-align text into a column?

    HTML/CSS footer on mobile site doesn't work on IPhone safari How to fix?

    How to remove an invisible space between div tags

    How to scroll in a div?

    How can I inline the label with the input horizontally and the inputs vertically

    JavaFX-CSS: How to “move” style of parent to a child?

    How to theorize about this phenomenon about
    tag

    How to remove hover effect from a column of a table

    CSS: How to use Transform property on a bootstrap grid class

    how to make a floating div disappear for smaller screens?

    How can I give an image a black opaque overlay?

    How to Change main menu color?

    How to extract class names from a CSS selector?