【发布时间】:2011-12-17 21:23:46
【问题描述】:
我花了几个小时试图让一个简单的重写工作,我对 mod_rewrite 的基本理解一定有错误:
我想要一个执行以下替换的规则:
www.example.com/fr/ -> www.example.com/?lang=fr
我正在工作,但对于子目录:
www.example.com/fr/other/directories/ -> www.example.com/other/directories/?lang=fr&lang=fr&lang=fr
似乎该规则对每个子目录都应用了一次(它应该只应用一次)。
此外,没有尾部斜杠的请求会导致另一个 lang=fr 附加到查询字符串
该规则位于
重写规则 ^/(en|fr|zh|gr|it)/(.*)$ /$2?lang=$1 [QSA]
我也在使用DocumentIndex /index.php index.php 指令
非常感谢。
【问题讨论】:
标签: apache mod-rewrite