MOD_REWRITE not creating correct path

Posted by Bill on Server Fault See other posts from Server Fault or by Bill
Published on 2011-01-06T05:47:09Z Indexed on 2011/01/06 5:55 UTC
Read the original article Hit count: 150

Filed under:
|
|

SO I am trying to setup a RewriteRule on my server for caching static objects. the files are in this naming scheme /docroot/css/stylesheet.min.css and I have them printed in the code like /docroot/css/stylesheet.min.123438348.css (the number is example it comes from a get modified function). Note docroot is an example directory

how can I have the server ignore the numbers and redirect to the stylesheet.min.css I need to do this for every css and js files (/js and /css) as well as one specific spritemap image

my current attempt RewriteRule ^/(docroot)/(js|css)/(.+).(min).(.+).(js|css)$ /$1/$2/$3.$4.$6 RewriteRule ^(/docroot/images/spritemap).([0-9]+).(png)$ $1.$3

Update: Now I have the setup like this RewriteEngine on Options FollowSymLinks RewriteRule ^(.+).(min).([0-9]+).(js|css)$ $1.$2.$4 [L]

This is rewriting localhost/docroot/css/stylesheet.min.12343242.css to /var/www/html/docroot/trunk/docroot/css/stylesheet.min.css

so it is getting the right file how do I get apache to take off the beginning of the that the /var/www/html/docroot/trunk/

© Server Fault or respective owner

Related posts about apache

Related posts about mod-rewrite