【问题标题】:Duplicate 'index.php' using ISAPI to re-write URL on IIS使用 ISAPI 复制“index.php”以在 IIS 上重写 URL
【发布时间】:2012-08-09 00:40:09
【问题描述】:

我正在使用 ISAPI_Rewrite v2 删除我在 IIS 6 上的 index.php。这就是重写的工作方式:

http://dev.mysite.co.uk/mypage      => http://dev.mysite.co.uk/index.php/mypage
http://dev.mysite.co.uk/anotherpage => http://dev.mysite.co.uk/index.php/anotherpage

使用 $_SERVER['REQUEST_URI'] 我可以看到实际发生的情况是这样的:

http://dev.mysite.co.uk/mypage      => http://dev.mysite.co.uk/index.php/index.php/mypage
http://dev.mysite.co.uk/anotherpage => http://dev.mysite.co.uk/index.php/index.php/anotherpage

这会导致 404 错误。重写规则包含在 httpd.ini 中,它位于我的子域的根文件夹中。这是我正在使用的规则:

[ISAPI_Rewrite]
RewriteRule ^(.*)$ /index.php/$1 [L]

有谁知道这可能是什么原因造成的?我发现 this post 描述了同样的问题,但没有答案。

谢谢

【问题讨论】:

    标签: url-rewriting iis-6 isapi isapi-rewrite


    【解决方案1】:

    我猜它只是循环,所以请尝试像这样修复它:

    [ISAPI_Rewrite]
    RewriteRule /(?!index\.php/.*)(.*) /index.php/$1 [L]
    

    【讨论】:

      猜你喜欢
      • 2011-04-01
      • 1970-01-01
      • 2010-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-03
      • 1970-01-01
      相关资源
      最近更新 更多