开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜