Tags:,, Posted in Uncategory Leave a Comment

使用301重定向 btbuzz.com 到www.btbuzz.com 可以防止网站流量的分流,优化网页收录,有利于网页PR传递,等等。在此不多说了。

在godaddy的linux主机上进行301重定向是很简单的,只需要修改主机.htaccess文件即可。具体的方法google一下有一大把在此也不多说了。但是很多人对在godaddy的windows虚拟主机中进行301 重定向却很陌生。

本文介绍一种在Windows虚拟主机下,尤其是godaddy的虚拟主机下从btbuzz.com通过301重定向到 www.btbuzz.com的方法。该方法在godaddy的windows虚拟主机中实现起来相当方便。当然有一个前提条件就是:windows主机使用的是IIS7.0或以上版本。 具体方法如下:

如果你的网站没有web.config文件。在网站的根目录下新建web.config文件并将一下代码加入到文件中。

<configuration>
   <system .webServer>
      <rewrite>
         <rules>
            <rule name="WWW Redirect" stopProcessing="true">
              <match url=".*" />
                 <conditions>
                    <add input="{HTTP_HOST}" pattern="^btbuzz.com$" />
                 </conditions>
              <action type="Redirect" url="http://www.btbuzz.com/{R:0}" redirectType="Permanent" />
            </rule>
         </rules>
      </rewrite>
   </system>
</configuration>

如果你的网站已经有了web.config文件。修改你的web.config文件。在web.config文件… 中的最后一行后面添加以下代码:

<rule name="WWW Redirect" stopProcessing="true">
  <match url=".*" />
    <conditions>
       <add input="{HTTP_HOST}" pattern="^btbuzz.com$" />
    </conditions>
       <action type="Redirect" url="http://www.btbuzz.com/{R:0}" redirectType="Permanent" />
</rule>

 

July 9, 2011

原创文章转载请注明出处:BtBuzz的blog

本文链接: http://www.btbuzz.com/uncategorized/136.html