【问题标题】:URL rewriting breaks when index.php?url=index (parameter is "index"). Why?当 index.php?url=index(参数为“index”)时,URL 重写中断。为什么?
【发布时间】:2014-01-22 00:20:12
【问题描述】:

奇怪的问题:我正在使用这个 .htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

获取这些 URL。完美运行。

http://www.example.com/cool/url

问题

但是当 ?url-参数中包含单词索引时,例如 in

http://www.example.com/index/page

然后 $_GET["url"] 为空。我认为我的 RewriteRule 坏了(尽管我在很多教程中都看到过这个 RewriteRule)并且从 URL 中删除 index.php 也会删除 index-parameter。

问题

如何修复,如何使 index/page 之类的 URL 成为可能?

【问题讨论】:

    标签: .htaccess url mod-rewrite


    【解决方案1】:

    这是由于MultiViews option

    将此行添加到您的 .htaccess 文件顶部以禁用 MultiViews

    Options -MultiViews
    

    【讨论】:

    • 太棒了!非常非常感谢你。固定!
    猜你喜欢
    • 2021-05-08
    • 2018-02-06
    • 1970-01-01
    • 2015-02-06
    • 1970-01-01
    • 1970-01-01
    • 2013-06-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多