With mod_rewrite, how do you redirect only images that were stored at the root level to a subdirectory?
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.
精彩评论