用htaccess重写图像路径? [英] Rewrite image path with htaccess?
本文介绍了用htaccess重写图像路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这些旧站点,它的所有.htm文件中都有图像url,如下所示,
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">
我想知道是否可以在所有之前添加绝对路径带有htaccess的图片网址。
I want to know if I can add an absolute path before all the image URLs with htaccess.
例如,
<img border="0" src="http://localhost/mysite/local/applications/bin/oldsite/images/logo.jpg" alt="xxx" width="170" height="150">
有可能吗?
还是这样做我必须逐个文件手动更改图像路径吗?
Or do I have to change the image path manually file by file?
我的尝试,
RewriteRule ^(.*\.(gif|jpg|png))$ local/applications/bin/oldsite/images/$1 [QSA,L]
当然不能正常工作!
推荐答案
我做到了
RewriteRule ^images\/(.*\.(gif|jpg|png))?$ local/applications/bin/oldsite/images/$1 [QSA,L]
这篇关于用htaccess重写图像路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文