利用web.config进行301重定向

在iis7里面,你可以通过地址重写(URL Rewrite )来实现网站主域名的301重定向。在web.config里加入如下规则,所有用户访问http://duoluodeyu.com将会自动跳转到http://www.duoluodeyu.com

<configuration>  <system.webServer>文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

<rewrite>文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

<rules>文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

<rule name="WWW Redirect" stopProcessing="true">文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

<match url=".*" />文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

<conditions>文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

<add input="{HTTP_HOST}" pattern="^freerun3shoes.com$" />文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

</conditions>文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

<action type="Redirect" url="http://www.freerun3shoes.com/{R:0}" redirectType="Permanent" />文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

</rule>文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

</rules>

</rewrite>

</system.webServer>

</configuration>

tips:此处使用“Permanent”(永久)定向。这样任何网站链接到你的网站时使用为非www地址,搜索引擎的robot将会抓取添加了www的网址作为你的网站网址,这样对SEO非常有帮助。

 最后更新:2015-7-1
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证