Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/mdaeo.org/usr/plugins/AMP/Action.php on line 388
godaddy用户windows主机通过web.config实现301重定向

Mdaeo'Blog

godaddy用户windows主机通过web.config实现301重定向

在godaddy用户windows主机通过web.config实现301重定向的方法

在iis7里面,你可以通过地址重写(URL Rewrite )来解决这个问题。在web.config里加入如下规则,所有用户访问http://yyphs.com将会自动跳转到http://www.yyphs.com
<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name="WWW Redirect" stopProcessing="true">

<match url=".*" />

<conditions>

<add input="{HTTP_HOST}" pattern="^gisforum.tk$" />

</conditions>

<action type="Redirect" url="http://www.gisforum.tk/{R:0}"

redirectType="Permanent" />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>


将以上代码 保存为Web.config 上传到godaddy 空间 即可 记着 要把55kc.com  换成自己域名 还有此方法 必须是 ii7才行
一个很重要事就是要使用“Permanent”(永久)定向。这样做很有帮助的是,任何人链接你的网站是使用的非www地址时,直接使搜索引擎的机器人在抓取作为永久移动的链接。新的url将会被定义为正确的地址,因此旧的非www地址将不会被索引。
 

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »

因本文不是用Markdown格式的编辑器书写的,转换的页面可能不符合AMP标准。