开发者

With mod_rewrite, how do you redirect only images that were stored at the root level to a subdirectory?

开发者 https://www.devze.com 2023-04-12 09:45 出处:网络
I have a site that stored all their images at the root level. I\'d like to move the images to a sub directory such as开发者_如何学编程 /media/images and then with mod_rewrite, direct all requests for

I have a site that stored all their images at the root level. I'd like to move the images to a sub directory such as开发者_如何学编程 /media/images and then with mod_rewrite, direct all requests for those images stored at the root level to the ones that have been moved to the directory /media/images?


RewriteRule ^([^/]+)(\.png|\.jpg|\.bmp|\.gif)$ media/images/$1$2

Should work nicely.

0

精彩评论

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