阿帕奇的.htaccess重写规则到IIS的web.config规则 [英] Apache .htaccess rewrite rule to IIS web.config rule

查看:229
本文介绍了阿帕奇的.htaccess重写规则到IIS的web.config规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我动了PHP应用程序来自Apache到IIS服务器。我想翻译以下的.htaccess规则:

I am moving a PHP application from Apache to IIS server. I am trying to translate the following .htaccess rule:

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

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

It simply redirects all requests (as well as query string) to public subdirectory.

我已经试过类似的web.config文件下列 -

I have tried something like the following in web.config file-

<?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规则在这种情况下?

But it keeps falling into redirect loop. What should be correct web.config rule in this case?

推荐答案

托管在IIS进口规则来解决这个问题。

Managed to solve this by importing rules in IIS.

http://akrabat.com/winphp-challenge / Zend的骨架,URL重写功能于IIS7 /

这篇关于阿帕奇的.htaccess重写规则到IIS的web.config规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆