Php .htaccess内容与Web.config内容的对话

Php .htaccess内容与Web.config内容的对话,php,xml,.htaccess,Php,Xml,.htaccess,我在Apache的.htaccess中有此url重写规则: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?route=$1 [L,QSA] 我知道你想把它转换成II7中的Web.config内容 <system.webServer> <rewrite&

我在Apache的.htaccess中有此url重写规则:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?route=$1 [L,QSA]
我知道你想把它转换成II7中的Web.config内容

<system.webServer>
    <rewrite>
        <rules>
            <rule name="DynamicRewrite" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{REQUEST_FILENAME}\.html" matchType="IsFile" />
                </conditions>
                <action type="Rewrite" url="/index.php?route={R:1}" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>


这似乎是正确的吗?谢谢

不是100%确定,但是您添加的条件是错误的。您的条件是请求+“.html”是一个文件。你想要的是:

<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
apache重写规则的一部分

因此:


我将代码付诸实施,但似乎没有响应。我必须在IIs服务器中进行一些配置吗?谢谢
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<system.webServer>
    <rewrite>
        <rules>
            <rule name="DynamicRewrite" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                </conditions>
                <action type="Rewrite" url="/index.php?route={R:1}" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>