mod_rewrite .htaccess - 样式表混乱
我正在尝试重写网站上的一些 URL,效果很好,只是样式表存在一些问题。所有样式表都适用于index.php,但当网址如下时则无效: localhost:8888/folder/path/(1,2,3,4)
我的样式表位于一个文件中,其中列出的样式如下:
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="includes/css/site.css"/>
<link rel="stylesheet" href="includes/css/viewProfile.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="includes/css/viewProvider.css" type="text/css" media="screen" title="no title" charset="utf-8">
有没有办法用 mod_rewrite 修复这个问题或者我该如何修复这个问题?
I'm trying to rewrite some URL's on my website, and it works fine, I just have some issues with the stylesheets. All stylesheets works at index.php but not when url's like: localhost:8888/folder/path/(1,2,3,4)
I have my stylesheets in a file where they're listed like this:
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="includes/css/site.css"/>
<link rel="stylesheet" href="includes/css/viewProfile.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="includes/css/viewProvider.css" type="text/css" media="screen" title="no title" charset="utf-8">
Is there a way to fix this with mod_rewrite or how would I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为您使用了样式表的相对路径。请注意,在这种情况下,浏览器会发送请求
。如果样式始终驻留在服务器根目录的配置中,则可以简单地将相对 URI 设为绝对 URI。或者您删除服务器端 CSS 文件的路径部分。
This is because you use a relative path to the style sheets. Note that the browser sends requests to
in that case. If the styles always reside in that configuration at the server root, you could simply make the relative URI an absolute one. Or you remove the path portion for CSS files on the server side.