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 make better CSS ID rules

    How to remove css from DOM

    How to change tinymce scrollbar color?

    css hover : aligning on bottom: how to align on top?

    How to load chosen alternative css as default css? [closed]

    How can I apply CSS to a JPG server-side?

    How to make an element slide with the viewport as it scrolls?

    How to display 'fit' image in CSS or HTML?

    How to combine two css3 gradients ?

    How to target html area maps with css

    How to position iframe (calendar) inside php echo statement?

    How to center smaller text with bigger css

    How to alter css style from parent page inside an iframe using jquery

    Ruby Command Line: How can I send the CTRL-C command via text in the command line?

    How to create a 'p' tag using css [closed]

    How to draw mobile device edge using CSS?

    How to make css jquery autofit navigation?

    How do CSS sprites work?

    How do I hover with text over div img?

    how to make dropdown menu using html & css

    How to verify background (css) image was loaded?

    How is possible to get 2d transformation css vertical way

    How to get a 2 column widget area defined in CSS?

    How do I center my logo image to another div in CSS horizontally and vertically?

    How to center links in header using CSS?

    How do I make an image semi-transparent?

    How to make commandeButon to vertical align?

    How to put images to the right and text to the left in css

    How to design a web page with multiple color panes without tables [duplicate]

    How to make compatibale a css design for all the browsers?