新建.htaccess文件,输入下列内容(需要开启mod_rewrite):
1)将不带WWW的域名转向到带WWW的域名下
复制代码 代码如下:
	
	Options +FollowSymLinks
	RewriteEngine on
	RewriteCond %{HTTP_HOST} ^zzvips.com [NC]
	RewriteRule ^(.*)$ http://www.zzvips.com/$1 [L,R=301]
	
	2)重定向到新域名
复制代码 代码如下:
	
	Options +FollowSymLinks
	RewriteEngine on
	RewriteRule ^(.*)$ http://www.baidu.com/$1 [L,R=301]
复制代码 代码如下:
	
	Options +FollowSymLinks
	RewriteEngine on
	RewriteRule ^news-(.+)\\.html$ news.php?id=$1
	
	将news.php?id=123这样的地址转向到news-123.html
为实现URL规范化,SEO通常将不带WWW的域名转向到带WWW域名,vhosts.conf中配置为:
复制代码 代码如下:
	
	<VirtualHost *:80>
	ServerName www.baidu.com
	DocumentRoot /home/fari001Com
	</VirtualHost>
	<VirtualHost *:80>
	ServerName faribaidu.com
	RedirectMatch permanent ^/(.*) http://www.baidu.com/$1
	</VirtualHost>
        
    		
            	
        
        
        
        