简体   繁体   English

如何修复.htaccess重写中的图像路径?

[英]How can I fix my image paths in a .htaccess rewrite?

I've made a rewrite rule as follows: 我制定了如下重写规则:

RewriteCond %{REQUEST_URI} !^(/index.php)|(index.php)|\.(gif|jpe?g|png)|(/public/)|(/forum/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?qs=$1

When one goes to say, www.example.com/a/b , everything is fine, except images. 有人说www.example.com/a/b ,除了图片,其他一切都很好。

Images are linked as relative paths in my script, and they are located in www.example.com/images , but server is trying to load images from www.example.com/a/b/images . 图片在我的脚本中被链接为相对路径,它们位于www.example.com/images ,但是服务器试图从www.example.com/a/b/images加载图片。

Is there a way to solve this problem by editing my RewriteRule? 有没有办法通过编辑RewriteRule解决此问题? This would be an optimal soloution, because it's very hard to change all the image paths in my script. 这将是最佳选择,因为很难更改脚本中的所有图像路径。

尝试此操作,作为您的第一行:

RewriteCond %{REQUEST_URI} !^(/index.php)|(/images)|(images)|(/forum/)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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