简体   繁体   English

使用htaccess后如何修复资源文件路径

[英]How to fix resource file path after using htaccess

When browser displays:当浏览器显示:

http://example.com/first/second http://example.com/first/second

and encounters a relative URL such as:并遇到一个相对 URL,例如:

<img src="site/images/photo.png">

It translates the relative URL to (respectively):它将相对 URL 转换为(分别):

http://example.com/first/second/site/images/photo.png http://example.com/first/second/site/images/photo.png

so what's the solution那么有什么解决办法

Try adding the code to just below the RewriteEngine On line尝试将代码添加到RewriteEngine On线下方

RewriteCond %{REQUEST_FILENAME} !-f

You can also added the following to the <head> , which might work either.您还可以将以下内容添加到<head> ,这也可能有效。

<base href="http://www.example.com/" />

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

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