点击登录
  • 欢迎访问无限星辰技术博客,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏无限星辰吧
  • 好集导航开张了,传送门:好集导航

iis7.5 web.config 301配置

WIN服务器 crx349 5610次浏览 0个评论 扫描二维码

先来看下,web.config中的301格式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
< ?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system .webServer>
<rewrite>
<rules>
 
<rule name="Redirect(命名)" stopProcessing="true">
<match url="^(要重定向的页面)"></match>
<conditions logicalGrouping="MatchAll" trackAllCaptures="false"></conditions>
<action type="Redirect" url="(重定向到的页面)"></action>
 
</rule>
</rules>
</rewrite>
</system>
</configuration>

多个页面跳转代码如下,以此类推

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
< ?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system .webServer>
<rewrite>
<rules>
 
<rule name="Redirect" stopProcessing="true">
<match url="^abc/001.html"></match>
<conditions logicalGrouping="MatchAll" trackAllCaptures="false"></conditions>
<action type="Redirect" url="http://"></action>
 
</rule><rule name="Redirect2" stopProcessing="true">
<match url="^abc/002.html"></match>
<conditions logicalGrouping="MatchAll" trackAllCaptures="false"></conditions>
<action type="Redirect" url="http://"></action>
 
</rule>
</rules>
</rewrite>
</system>
</configuration>

多个页面跳转时,rule name 不能相同

整站301跳转

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
< ?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system .webServer>
<rewrite>
<rules>
<rule name="WWW Redirect" stopProcessing="true">
<match url=".*"></match>
<conditions>
<add input="{HTTP_HOST}" pattern="^需要转的域名$"></add>
</conditions>
<action type="Redirect" url="http://要转到的域名/{R:0}"
redirectType="Permanent"></action>
</rule>
</rules>
</rewrite>
</system>
</configuration>

无限星辰 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明iis7.5 web.config 301配置!
喜欢 (2)
[]
分享 (0)

您必须 登录 才能发表评论!