不同网站服务器网页301重定向设置-三盈网络,深圳网站建设公司 
圈子资讯|咨询电话:183-2065-5007
不同网站服务器网页301重定向设置
时间:2014-10-10 00-00-00

第一种情况,windows系统的服务器或者vps

IIS下301设置
Internet信息服务管理器 -> 虚拟目录 -> 重定向到URL,输入需要转向的目标URL,并选择'资源的永久重定向'。

第二种情况,Linux的主机。


做整站301跳转,只需要修改文件httpd.conf或者.htaccess文件保存就可以了:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^xxxx.com [NC]

RewriteRule ^(.*)$ http://www.xxxx.com/$1 [L,R=301]

第三种情况,虚拟主机如何实现

虚拟主机可以利用httpd.ini文件为网站设置301永久重定向

1、网站服务器是IIS,在httpd.ini文件开始处加入以下规则:
RewriteCond Host: ^xxxx.com$
RewriteRule (.*) http://www.xxxx.com$1 [I,RP]

如果不存在httpd.ini,可以新建一个,添加如下代码:

[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteCond Host: ^xxxx.com$
RewriteRule (.*) http://www.xxxx.com$1 [I,RP]

2、若网站服务器是Apache,新建.htaccess文件,输入下列内容(需要开启mod_rewrite)

在.htaccess文件开始处加入一下规则

RewriteCond %{http_host} ^xxxx.com [NC]
RewriteRule ^(.*)$ http://www.xxxx.com/$1 [R=301,L]

附、httpd.ini多域名301跳转代码
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteCond Host: ^xxxx2.com$
RewriteRule (.*) http://www.xxxx2.com$1 [I,RP]
RewriteCond Host: ^www.xxxx2.com$
RewriteRule (.*) http://www.xxxx1.com$1 [I,RP]
RewriteCond Host: ^xxxx1.com$
RewriteRule (.*) http://www.xxxx1.com$1 [I,RP]

希望能帮到有困难的人~


联系我们contact us
  • 18320655007
  • 13924654107(朱经理)
  • 13927414511
  • 460584196@qq.com
  • 深圳市宝安区西乡街道前进二路93号彩虹城4楼B95
  • 信宜市实验学校旁三盈网络
三盈网络科技有限公司 © 版权所有 粤ICP备2023040535号
主营业务:全网营销网站,外贸网站,抖音推广,爱采购,网页设计,全网营销方案