简体   繁体   中英

Rewrite old image urls to new url

So I had some images that were in the root folder of the website, and they are linked from another website using <img src="" />

after the redesign things changed and now the images are in a new folder called imgs

So what I need is somehow the old urls to work but serve the image from another folder.

http://example.com/file.JPG should be served from http://example.com/imgs/file.JPG

I've tried this but doesn't work

RewriteRule ^/(.*)\.JPG$ /imgs/$1\.JPG [L,R]

You can use this rule:

RewriteEngine On

RewriteRule ^([^/.]+\.jpe?g)$ /imgs/$1 [L,NC,R=302]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM