【问题标题】:Multiple subdirectory error with mod_rewritemod_rewrite 出现多个子目录错误
【发布时间】:2011-11-05 10:22:16
【问题描述】:

我正在尝试在 joomla 中手动使用 mod_rewrite,并且我有以下规则:

RewriteRule ^test/(t1|t2|t3)-(.*).html$ /index.php?option=com_jumi&fileid=39&$1=$2 [L,NC]

所以我想要网址

http://www.mysite.com/index.php?option=com_jumi&fileid=39&t1=foo

像这样显示

http://www.mysite.com/test/t1-foo.html

该规则正常工作,但是当我在重写页面中时,链接像

 http://www.mysite.com/link.html 

http://www.mysite.com/xxx/link.html

成为

 http://www.mysite.com/test/link.html 

http://www.mysite.com/xxx/test/link.html

分别。

有什么建议吗?

谢谢

【问题讨论】:

    标签: .htaccess mod-rewrite joomla


    【解决方案1】:

    您在页面中使用相对 url。您的页面包含一个类似<a href="link.html">... 的链接,并且浏览器使链接相对于当前的“文件夹”,即“测试”,因此当点击浏览器时会加载/test/link.html

    您应该只使用相对于根目录的网址。所以链接应该更像<a href="/link.html">...。前导的 '/' 使浏览器加载相对于根 ("/") 的页面,而不是相对于 "/test/"。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多