例:
在下面的例子中,“目录包含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>

相关文章:

  • 2021-12-17
  • 2022-03-05
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-05
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2021-04-26
  • 2022-02-07
相关资源
相似解决方案