raksmart活动促销

分享

写回答

发帖

本站使用的是Win主机,所以是通过对web.comfig进行了301重定向

国外虚拟主机 国外虚拟主机 1535 人阅读 | 0 人回复

发表于 2011-4-29 02:07:03 | 显示全部楼层 |阅读模式

本站使用的是Win主机,所以是通过对web.comfig进行了301重定向
代码如下:
        <rule name="WWW Redirect" stopProcessing="true">
              <match url=".*" />
                 <conditions>
                    <add input="{HTTP_HOST}" pattern="^webwe6.com$" />
                 </conditions>
              <action type="Redirect" url="http://www.webwe6.com/{R:0}"
                 redirectType="Permanent" />
        </rule>
复制代码
至于Apache服务器的.htaccess实现301重定向可参考以下修改方法,未经测试,请修改前备份!
RewriteEngine on
RewriteCond %{http_host} ^webwe6.com [NC]
RewriteRule ^(.*)$ http://www.webwe6.com/$1 [L,R=301]
复制代码
IIS服务器实现301重定向:

用ASP/PHP实现301重定向:

ASP:
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”,”http://www.webwe6.com/”
Response.End
复制代码
PHP:
header(“HTTP/1.1 301 Moved Permanently”);
header(“Location:http://www.webwe6.com/”);
exit();
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则