Hello I've got a Rewrite rule I'm attempting to implement on my small local host however i cannot have it to perform the action regardless of how I setup the regex

the files have been in this naming plan /docroot/css/stylesheet.min.css and that i ask them to printed within the code like /docroot/css/stylesheet.min.123438348.css (the amount is example it develops from a get modified function). Note docroot is definitely an example directory

how do i possess the server disregard the amounts and redirect towards the stylesheet.min.css I have to do that for each css and js files (/js and /css) in addition to 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 

I've this covered with a I'm on linux..if this is mod_rewrite.so?"


And So I am attempting to setup a RewriteRule on my small server for caching static objects. the files have been in this naming plan /docroot/css/stylesheet.min.css and that i ask them to printed within the code like /docroot/css/stylesheet.min.123438348.css (the amount is example it develops from a get modified function). Note docroot is definitely an example directory

how do i possess the server disregard the amounts and redirect towards the stylesheet.min.css I have to do that for each css and js files (/js and /css) in addition to 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've the setup such as this

<Location />
RewriteEngine on
Options FollowSymLinks
RewriteRule ^(.+)\.(min)\.([0-9]+)\.(js|css)$ $1.$2.$4 [L]
</Location>

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

so it's obtaining the right file how do you get apache to consider off the start of the the /var/www/html/docroot/trunk/

<Location />
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.+)\.(min)\.([0-9]+)\.(js|css)$ $1.$2.$4 [PT]
</Location>

Options FollowSymLinks in Directory listing

Ok Now rather than

/var/www/html/docroot/trunk/docroot/css/stylesheet.min.css 

I get a url that appears such as this

/docroot/trunk/docroot/css/stylesheet.min.css

I Removed the RewriteBase command and so i still have to take away the beginning /docroot/trunk

The pattern of rules for per-directory rewrites is different from individuals for any global rewrites:

  • While using the rewrite engine inshtaccess files the per-directory prefix (which always is identical for any specific directory) is instantly removed for that RewriteRule pattern matching and instantly added after any relative (not beginning having a slash or protocol title) substitution encounters the finish of the rule set. Begin to see the RewriteBase directive to learn more regarding what prefix is going to be added to relative substutions.
  • The removed prefix always finishes having a slash, meaning the matching happens against a string which never includes a leading slash. Therefore, A Pattern with ^/ never matches in per-directory context.

So try these designs with no leading prefix /:

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