网站更换域名,而又不影响搜索引擎,可以设置301永久重定向。很多个人网站都采用的虚拟主机,一般都具备自定义httpd.ini功能,这样的话,就很轻松的使用httpd.ini设置301永久重定向。在httpd.ini中加入以下内容:
RewriteCond Host: ^www.123\.cn$
RewriteRule (.*) http\://www\.321\.cn$1 [I,RP]
可以实现将www.123.cn永久定向到www.321.cn。
另外,很多网站都是将123.cn定向到www.123.cn,这样将权重全部集中在www.123.cn,可以采用如下代码:
RewriteCond Host: ^123\.cn$
RewriteRule (.*) http\://www\.123\.cn$1 [I,RP]
如果httpd.ini中没有设置其它内容,那么完整的代码如下:
[ISAPI_Rewrite]
CacheClockRate 3600
RepeatLimit 32
RewriteEngine On
RewriteCond Host: ^123\.cn$
RewriteRule (.*) http\://www\.123\.cn$1 [I,RP]
注意:自定义httpd.ini必须主机支持,必须具备ISAPI_Rewrite模块。


