0

我是 Url 重写规则的新手,因此我们将不胜感激任何帮助。

希望创建一个 IIS Url 重写来处理以下任何内容

http://localhost/homepage/contact-us.aspx -> http://localhost/contact-us.aspx
http://localhost/homepage/about-us.aspx -> http://localhost/about-us.aspx

有任何想法吗?

4

1 回答 1

0

我尚未对此进行测试,但我认为您的 web.config 文件中会有类似的内容。

您可以编辑 web.config 文件,然后进入 IIS,如果您想测试它,该规则应该会显示出来。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="rewriterule1" enabled="true" stopProcessing="false">
                    <match url="homepage/(.*)" />
                    <action type="Rewrite" url="http://localhost/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
于 2012-11-12T13:48:10.320 回答