帮助中心首页 > 虚拟主机  > 虚拟主机常见问题  >  如何做301跳转

如何做301跳转

作者:景安网络帮助中心发布时间:2015-07-03浏览次数:11912

 

Linux下301重定向设置

1.登陆后台,开启伪静态支持
2.将下面的代码复制到.htaccess文件中,保存。
(单个域名跳转)
RewriteEngine on
RewriteBase /
RewriteCond %{http_host} ^zzidc.com [NC]
RewriteRule ^(.*)$ 
http://www.zzidc.com/$1 [L,R=301]

多个域名跳转
RewriteEngine on
RewriteBase /
RewriteCond %{http_host} ^www.mbaoo.net [NC]
RewriteRule ^(.*)$ 
http://www.zzidc.com/$1 [L,R=301]
RewriteCond %{http_host} ^www.mbaoo.com [NC]
RewriteRule ^(.*)$ 
http://www.zzidc.com/$1 [L,R=301]

或者
RewriteCond %{http_host} ^www\.1\.com.* [OR]
RewriteCond %{http_host} ^1\.com.* [OR]
RewriteCond %{http_host} ^2\.com.*
RewriteRule ^(.*)$ 
http://www.2.com/$1 [L,R=301]

3.将.htaccesss文件上传至站点根目录下。


IIS 7 301 重定向代码 加到web.config里
<configuration>
<system.webServer>
<rewrite>
    <rules>
        <rule name="Enforce canonical hostname" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTP_HOST}" negate="true" pattern="^www.zzidc.com$" />
            </conditions>
            <action type="Redirect" url="
http://www.zzidc.com/{R:1}" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>
        <defaultDocument>
            <files>
                <add value="index.asp" />
            </files>
        </defaultDocument>
</system.webServer>
</configuration>

  • 联系销售
    很高兴为您服务
    尊敬的客户您好,欢迎您来到快云,成为我们的用户。
    开始售前咨询
    在线联系售前顾问,一对一解答
    请添加我的企业微信
    为您提供1V1产品咨询,上云方案定制服务
    企业微信
  • 请添加微信公众号
    扫码登录,业务提醒
    工单申报,优惠活动
    关注公众号