mod_rewrite如何显示特定目录中的图像
我开始使用 mod_rewrite 并想知道以下是否可行...
RewriteRule ^test/([^/]*)/$ /test.php?x=$1 [NC,L]
这按预期工作,但是,一旦生成 HTML,我就使用图像/样式表等的相对路径,例如 现在不再显示。
我该如何解决这个问题?
非常感谢
I am starting to use mod_rewrite and would like to know if the below is possible...
RewriteRule ^test/([^/]*)/$ /test.php?x=$1 [NC,L]
That works as expected however, once the HTML generates I use relative paths to images/stylesheets etc such as <img src="include/image.jpg" />
which now no longer shows.
How can I get around this?
Many Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种方法是添加一条规则跳过以标准图像文件后缀结尾的请求:
One way to do it is to add a rule to skip requests that end in standard image file suffixes:
有几种可能性:
标记添加到您的 HTML 中。There are several possibilities:
<base>
tag to your HTML.