Help with mod-rewrite rule
I need to rewrite urls to site media (images, js, css) like this:
/folder1/css/css.css
to /www/folder1/css/css.css
/folder2/img/image.jpg
to /www/folder2/img/image.jpg
I have a se开发者_如何学编程t of folders that contain these files, so it would be nice not to list all those folders, and have a universal rule. Is that possible?
This should works:
RewriteEngine On
RewriteRule ^(.*/(?:css|img)/.*)$ /www/$1
You must make sure that all your images/css are on <folder>/css/<filename>
or <folder>/img/<filename>
. Each URL containing .../css/...
or .../img/...
will be prefixed a /www
.
精彩评论