Forum Moderators: phranque
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}!/css_folder/style.css #to not loop
RewriteCond %{REQUEST_FILENAME}!-f #if doesn't exist
RewriteRule (.*).css /css_folder/$1.css #redirect
RewriteEngine on
# not to loop
RewriteCond %{REQUEST_FILENAME} !/css_folder/
#if doesn't exist
RewriteCond %{REQUEST_FILENAME} !-f
# redirect
RewriteRule ([^/.]+)\.css$ /css_folder/$1.css [L]
RewriteRule ^(.+)\.css$ /css_folder/$1.css [L]
Jim
What's the benefit of doing this?
This broken path is being rewritten to the exsisting path [example.com...]
Bob
RewriteRule ^css_folder/.* - [L] That ends all mod_rewrite processing for the directory in question (the [L] flag), but does nothing else (the - rule).
After that, the rule doing your actual internal redirect can be very simple, and doesn't need any further tests:
RewriteRule (.*).css /css_folder/$1.css [L]
this is not working for me,
# not to loop
RewriteCond %{REQUEST_FILENAME}!/images/
#if doesn't exist
RewriteCond %{REQUEST_FILENAME}!-f
# redirect
rewriterule ([^/.]+)\.gif$ /images/$1.gif [L]
for exemple ..