【发布时间】:2008-12-22 17:36:38
【问题描述】:
在我的 Joomla 网站上,我在我的 .htaccess 文件中添加了一些相当直接的 RewriteRules。它们都是这样的一对一规则,因为我正在更改站点的文件结构并且不想破坏我的旧链接。
RewriteRule ^content/view/54/48/$ /courses [R]
这些是 Joomla 附带的现有规则的补充:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
如果我注释掉现有的 Joomla 规则,那么我可以看到我的规则正常工作,当我输入 http://example.com/content/view/54/48/ 时,我的浏览器地址栏会更改为 http://example.com/courses,但是如果我离开其他规则,那么 Joomla不知道如何处理它(它给出“未知组件错误”)。如果我直接输入http://example.com/courses,那么它会按预期工作,所以我觉得这是我重写的问题,而不是Joomla。
我认为 RewriteRules 是按顺序相互作用的。例如:
RewriteRule a b
RewriteRule b c # a request for "a" will take you to "c"
我在共享主机上,所以很遗憾我无法打开登录。有人对我有什么建议吗?
【问题讨论】:
标签: apache mod-rewrite http-headers