web.config中httpRedirect - 重定向单个页面
例:
在下面的例子中,“目录包含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
>
</
system.webServer
>
</
location
>
<
location
path
=
"page3.htm"
>
<
system.webServer
>
<
httpRedirect
enabled
=
"true"
destination
=
"http://news.yahoo.com/science/"
httpResponseStatus
=
"Permanent"
/>
</
system.webServer
>
</
location
>
</
configuration
>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。