RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !olddomain.com$ [NC] RewriteRule ^(.*)$ [L,R=301]
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.domain.com$ RewriteRule ^file/file.php$ [R=301,L]
3.重定向olddomain.com到www.newdomain.com
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC] RewriteRule ^(.*)$ [L,R=301]
2.重定向www.domain.com到domain.com
6.重定向domain.com/file/file.php 到 otherdomain.com/otherfile/other.php
5.全体重定向到newdomain
-->
RewriteEngine On RewriteBase / RewriteCond %{http_host} ^domain.com [NC] RewriteRule ^(.*)$ [L,R=301]
1.重定向domain.com到www.domain.com 这种重定向旨在使域名独一,是网站SEO必需要做的,后面重定向www.domain.com到domain.com也是出于同样的起因,只是情势不同。 翻开.htaccess文件,参加以下规矩。(下面的规则是针对主域名的,子域名要修正)
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !olddomain.com$ [NC] RewriteRule ^(.*)$ [L,R=301]
4.重定向olddomain.com to newdomain.com
Options +FollowSymLinks RewriteEngine on RewriteRule ^(.*)$ [L,R=301]
相关的主题文章:
(责任编辑:admin) |