views:

17

answers:

1

Hello all,

This is probably straight forward for someone who know apache mod rewrite and regex but that someone is not me. This is what I am looking for : I just want to re-route image,css requests to one shared repository image/css file. e.g. we have 6-7 sites which can be on same server or different. Currently, image looks like this /img/site1_header.jpg, all I want is that internally this request should become /img/header.jpg so basically remove the variable 'site1' (or site2,site 3)

Any help appreciated.

thanks

A: 

I haven't tested it, but I expect it will look something like:

RewriteEngine On
RewriteRule ^(.*)/(site[0-9]*_)(.*)$ $1/$2 [PT,L]
bbadour
Thanks. sorry, I wasn't clear. the keyword variable I mentioned(as site1,site2,site3....) could be any string. site1,site 2 were just examples . I am going to try to take your regex as base and try to tweak it to cover my needs. much appreciated.
aboxy
I think this would work : ^(.*)\/(.*_)(.*)$
aboxy
It seems you got the answer you needed. How about working on your accept rate?
bbadour