【问题标题】:Getting an infinite loop with mod_rewrite使用 mod_rewrite 获得无限循环
【发布时间】:2013-09-24 08:25:24
【问题描述】:

我有以下配置:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^(index\.php|robots\.txt|static|uploads)(/.*)?$
RewriteRule ^admin(/.*)?$ /index.php/admin$1 [L]
RewriteRule ^([^/]+)(/.*)?$ /index.php/webshops$2?dealer=$1 [L,QSA]

即使我在重写条件中排除index.php,我仍然收到以下错误:

由于可能的配置错误,请求超出了 10 次内部重定向的限制。

可能出了什么问题?

【问题讨论】:

    标签: apache mod-rewrite


    【解决方案1】:

    %{REQUEST_URI} 变量始终以/ 开头,因此您需要将其包含在您的正则表达式中:

    RewriteCond %{REQUEST_URI} !^/(index\.php|robots\.txt|static|uploads)(/.*)?$
    

    【讨论】:

    • @not-rightfold 抱歉,您需要在两条规则之前添加条件。 RewriteCond 指令仅适用于紧随其后的RewriteRule
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多