利用web.config进行301重定向

2013年3月19日20:45:27网站建设评论691

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

<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>文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

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

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

</configuration>

tips:此处使用“Permanent”(永久)定向。这样任何网站链接到你的网站时使用为非www地址,搜索引擎的robot将会抓取添加了www的网址作为你的网站网址,这样对SEO非常有帮助。文章源自堕落的鱼-https://www.duoluodeyu.com/824.html

文章源自堕落的鱼-https://www.duoluodeyu.com/824.html
常用正则表达式汇总 网站建设

常用正则表达式汇总

很多不太懂正则的朋友,在遇到需要用正则校验数据时,往往是在网上去找很久,结果找来的还是不很符合要求。所以我最近把开发中常用的一些正则表达式整理了一下,在这里分享一下。给自己留个底,也给朋友们做个参考。...
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定