IIS7 URL Rewrite rule to perform a 301 redirect from *.html files to *.php files

前端 未结 1 1773
暗喜
暗喜 2021-01-14 06:22

I would like to use the URL Rewrite module of IIS7 to create 301 redirects based on a specific pattern.

I have a web site that consists of only .HTML files. I am con

相关标签:
1条回答
  • 2021-01-14 06:50

    Here you go:

    <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>
    

    Tested on IIS 7.5 with URL Rewrite module v2.0 -- works fine.

    0 讨论(0)
提交回复
热议问题