【问题标题】:Apache .htaccess rewrite rule to IIS web.config ruleApache .htaccess 将规则重写为 IIS web.config 规则
【发布时间】:2012-08-22 17:57:44
【问题描述】:

我正在将 PHP 应用程序从 Apache 移动到 IIS 服务器。我正在尝试翻译以下 .htaccess 规则:

RewriteEngine On
RewriteRule ^(.*)$ public/$1?%{QUERY_STRING} [QSA,L]

它只是将所有请求(以及查询字符串)重定向到公共子目录。

我在 web.config 文件中尝试过类似以下内容-

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
    <rewrite>
        <rules>
            <rule name="Root Hit Redirect" stopProcessing="true">
                <match url="^$" />
                <action type="Redirect" url="/public/index.php" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>

但它不断陷入重定向循环。在这种情况下,正确的 web.config 规则应该是什么?

【问题讨论】:

    标签: .htaccess iis url-rewriting web-config


    【解决方案1】:

    设法通过在 IIS 中导入规则来解决这个问题。

    http://akrabat.com/winphp-challenge/zend-framework-url-rewriting-in-iis7/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-29
      • 1970-01-01
      • 2011-04-25
      • 1970-01-01
      • 2014-06-30
      • 2016-08-09
      • 1970-01-01
      • 2014-11-21
      相关资源
      最近更新 更多