Apache - 禁用自动重写
我刚刚开始在本地 apache 设置上测试 mod_rewrite 的使用情况。
虽然重写规则工作正常,但我的问题是像“localhost/foo/”这样的页面会自动重定向到“localhost/foo.php”。即使没有重写规则也会发生这种情况。这是正常的吗?我认为不会,因为这不会发生在我的托管域上。我怎样才能禁用这个功能?
I'm just beginning to test my usage of mod_rewrite on a local apache setup.
While rewrite rules are working fine, my problem is that a page like "localhost/foo/" is automatically redirected to "localhost/foo.php". This happens even with no rewrite rules. Is this normal? I assume not, since this does not happen on my hosted domain. How can I disable this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
找出问题所在 - 将其记录为未来搜索者的答案 [这是正确的过程吗?]
我必须禁用 MultiViews - 如果可以找到该文件,它会将 localhost/foo 重定向到 localhost/foo.php。完成后一切都很好。
Figured out what the problem was - documenting it as an answer for future searchers [is this the correct procedure?]
I had to disable MultiViews - it was redirecting localhost/foo to localhost/foo.php if it could find that file. Everything worked just fine once that was done.
某种重写正在进行中。您可以重命名磁盘上的实际模块以确保其未被使用。在 Linux 中,它是 /usr/lib/httpd/modules/mod_rewrite.so
Some sort of rewrite is going on. You could rename the actual module on disk to make sure its not used. In Linux it is /usr/lib/httpd/modules/mod_rewrite.so