【发布时间】:2011-02-19 05:39:10
【问题描述】:
我希望 Apache 转换或重定向
example.com/someController/someAction/5
到
example.com/?c=someController&a=someAction&id=123
我想将一些 mod_rewrite 规则放在一个 .htaccess 文件中,我可以将它放在与 index.php 相同的目录中。在上面的示例中,.htaccess 和 index.php 位于 example.com 文件夹中。
我希望规则在相对路径上运行,这样如果我的站点位于另一个域和子目录中,它就可以工作。示例:
otherdomain.com/subdirectory/someController/someAction/5
到
otherdomain.com/subdirectory/?c=someController&a=someAction&id=123
在本例中,index.php 和 .htaccess 位于“子目录”文件夹中。
【问题讨论】:
标签: apache .htaccess mod-rewrite