首页>文档>虚拟主机>如何做301跳转

如何做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>

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
客户经理
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索

梦飞科技 - 最新云主机促销服务器租用优惠