【发布时间】:2015-10-05 05:12:44
【问题描述】:
我尝试在 htaccess 文件中添加这个表达式
footerrelated ^help/([A-Za-z0-9-]+)/?$ index.php?requestedPage=footerrelated&page=$1 [NC,L]
所以当用户输入类似的链接时
http://localhost/askRondWebsite/public_html/footerrelated/helpcenter
应该返回
http://localhost/askRondWebsite/public_html/index.php?requestedPage=footerrelated&page=helpcenter
但这会导致页面中的相对链接出现问题。
例如,在我的页面中,我有以下link 标签
<link rel="stylesheet" type="text/css" href="css/fotterrelated.css">
指的是http://localhost/askRondWebsite/public_html/css/fotterrelated.css。
但是当我添加htaccess 表达式时,链接指向http://localhost/askRondWebsite/public_html/fotterrelated/css/fotterrelated.css。
即使在 public_html 文件夹中没有创建名为 fotterrelated 的文件夹时,我网站中的所有相对 URL 也会发生这种情况。
为什么会这样?在添加 htaccess 表达式之前,我应该怎么做才能保持相对 URL 不变?
【问题讨论】: