繁体   English   中英

Apache .htaccess将规则重写为IIS web.config规则

[英]Apache .htaccess rewrite rule to IIS web.config rule

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

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

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

我已经在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规则应该是什么?

通过在IIS中导入规则来解决此问题。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM