例:
在下面的例子中,“目录包含page1.htm,page2.htm,page3.htm和page4.htm。如下所示的web.config文件将执行以下操作
/pages/page1.htm会重定向到/newpages/newpage.htm
/pages/page2.htm会重定向到谷歌
/pages/page3.htm会重定向到雅虎的特定页面

<?xml version="1.0"?>
<configuration>
    <location path="page1.htm">
        <system.webServer>
            <httpRedirect enabled="true" destination="http://www.victor-ratajczyk.com/examples/webconfig/redir/newpages/newpage.htm" httpResponseStatus="Permanent" />
        </system.webServer>
    </location>
    <location path="page2.htm">
        <system.webServer>
            <httpRedirect enabled="true" destination="http://www.google.com" httpResponseStatus="Permanent" />
        </system.webServer>
    </location>
    <location path="page3.htm">
        <system.webServer>
            <httpRedirect enabled="true" destination="http://news.yahoo.com/science/" httpResponseStatus="Permanent" />
        </system.webServer>
    </location>
</configuration>
05-15 06:41