IIS7 URL重写规则,执行从*.html文件到*.php文件的301重定向



我想使用IIS7的URL重写模块基于特定模式创建301重定向。

我有一个网站,只包括。html文件。我正在将站点转换为. php文件,但保留所有相同的文件名。例如,以下url…

/index.html
/contact/contact.html
/membership/member.html

将成为…

/index.php
/contact/contact.php
/membership/member.php

谁能告诉我如何创建这个规则?

谢谢。

给你:

<system.webServer>
    <rewrite>
        <rules>
            <rule name="html2php" stopProcessing="true">
                <match url="^(.+).html$" />
                <action type="Redirect" url="{R:1}.php" redirectType="Permanent" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

在IIS 7.5和URL重写模块v2.0上测试—工作正常

最新更新