mod_rewriting 的乐趣在于两个 .htaccess 文件...一个用于 wordpress,一个用于子目录中的 CI
我遇到了一个奇怪的情况,所以我希望有人可以帮助我。
我在根目录中有一个 wordpress 安装,在子目录中有一个 codeigniter 安装(我知道,我知道......)。两者都各自工作得很好。 codeigniter 安装有自己的 .htaccess 文件,用于重写 index.php。
但是,如果我想要将 codeigniter 目录之外的 URL 重写到 codeigniter 目录,然后该目录将由 CI .htaccess 文件再次重写,该怎么办?
例如:
example.com/2010/10/article-title is a URL used by wordpress. THIS WORKS
example.com/codeigniter/ is the root of codeigniter. THIS WORKS
example.com/codeigniter/controller/action is a CI URL. THIS WORKS
但是如果我想指出
example.com/users/list to example.com/codeigniter/users/list
然后让 CI 正确重写怎么办?
这可以在没有硬重定向的情况下完成吗?
I have a weird situation that's come up, so I'm hoping some one can help me out.
I have a wordpress installation in the root directory and a codeigniter installation in a subdirectory (I know, I know...). Both are working fine on their own. The codeigniter installation has its own .htaccess file for rewriting to index.php.
But what if I wanted a URL outside of the codeigniter directory to rewrite to the codeigniter directory, which will then be rewritten again by the CI .htaccess file.
For example:
example.com/2010/10/article-title is a URL used by wordpress. THIS WORKS
example.com/codeigniter/ is the root of codeigniter. THIS WORKS
example.com/codeigniter/controller/action is a CI URL. THIS WORKS
But what if I wanted to point
example.com/users/list to example.com/codeigniter/users/list
and then have this be properly rewritten by CI?
Is this possible to do without a hard redirect?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的根目录 .htaccess 中上方写入 WordPress 规则:
In your root directory .htaccess write above the WordPress rules: