欢迎来到梦飞科技

虚拟主机

当前优惠活动:

如何做301跳转

Linux下301重定向设置

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

多个域名跳转
RewriteEngine on
RewriteBase /
RewriteCond %{http_host} ^www.hkdfc.net [NC]
RewriteRule ^(.*)$ http://www.mfisp.com/$1 [L,R=301]
RewriteCond %{http_host} ^www.hkdfc.com [NC]
RewriteRule ^(.*)$ http://www.mfisp.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.mfisp.com$" />
            </conditions>
            <action type="Redirect" url="http://www.mfisp.com/{R:1}" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>
        <defaultDocument>
            <files>
                <add value="index.asp" />
            </files>
        </defaultDocument>
</system.webServer>
</configuration>

梦飞科技 - 全球数据中心基础服务领先供应商

Copyright © 2003-2019 MFISP.COM. 国外服务器租用 IDC公司 版权所有 粤ICP备11019662号