I have these old site and it has the image url in all of its .htm files like this below,
<img border="0" src="images/logo.jpg" alt="xxx" width="170" height="150">
I want to know if I can add an absolute path before all the image URLs with htaccess.
For instance,
<img border="0" src="http://localhost/mysite/local/applications/bin/oldsite/images/logo.jpg" alt="xxx" width="170" height="150">
Is it possible?
Or do I have to change the image path manually file by file?
My attempt,
RewriteRule ^(.*\.(gif|jpg|png))$ local/applications/bin/oldsite/images/$1 [QSA,L]
not working of course!
Your rule
RewriteRule ^(.*\.(gif|jpg|png))$ local/applications/bin/oldsite/images/$1 [QSA,L]
would redirect images/image.jpg
to local/applications/bin/oldsite/images/images/image.jpg
Lose the images/
part from the end of your rule:
RewriteRule ^(.*\.(gif|jpg|png))$ local/applications/bin/oldsite/$1 [QSA,L]
我是用这条规则做到的
RewriteRule ^images\/(.*\.(gif|jpg|png))?$ local/applications/bin/oldsite/images/$1 [QSA,L]
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.