1、添加域名解析,用别名来做。
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
ServerAdmin liuyi@315zhaopin.com
DocumentRoot "/data/home/www/www"
ServerName 777zp.com
ServerAlias
ServerAlias
ServerAlias
ServerAlias
ServerAlias
ServerAlias 777zhaopin.cn
ServerAlias 777zhaopin.com
ServerAlias
ServerAlias xn--777-yh6Fq51K.com
ServerAlias
ServerAlias xn--777-yh6F996JckB.com
ServerAlias
ServerAlias xn--777-yh6fq51K.xn--fiqs8s
ServerAlias
ServerAlias xn--777-yh6F996JckB.xn--fiQs8S
ServerAlias
ServerAlias 777rencai.com
ServerAlias
ServerAlias 777zp.com
ServerAlias
ServerAlias 777zp.cn
ServerAlias
ErrorLog "logs/-error_log"
CustomLog "logs/-access_log" common
添加一条 : ServerAlias
保存退出。
2、做301跳转,修改。htaccess文件。
vim /data/home/www/www/.htaccess
RewriteEngine On
RewriteBase /
# Rewrite规则
RewriteRule ^index\.htm$ index\.php
RewriteRule ^jobs/jobs-show-([0-9]+)\.htm$ jobs/jobs-show\.php\?id=$1
RewriteRule ^company/company-show-([0-9]+)\.htm$ company/company-show\.php\?id=$1
RewriteRule ^resume/resume-show-([0-9]+)\.htm$ resume/resume-show\.php\?id=$1
RewriteRule ^news/news-list-([0-9]+)-([0-9]+)\.htm$ news/news-list\.php\?id=$1&page=$2
RewriteRule ^news/news-show-([0-9]+)\.htm$ news/news-show\.php\?id=$1
RewriteRule ^explain/explain-show-([0-9]+)\.htm$ explain/explain-show\.php\?id=$1
RewriteRule ^notice/notice-list-([0-9]+)-([0-9]+)\.htm$ notice/notice-list\.php\?id=$1&page=$2
RewriteRule ^notice/notice-show-([0-9]+)\.htm$ notice/notice-show\.php\?id=$1
RewriteEngine on
RewriteCond %{http_host} ^777zp.com [NC]
RewriteRule ^(.*)$ http:///$1 [L,R=301]
RewriteCond %{http_host} ^777zhaopin.com [NC]
RewriteRule ^(.*)$ http:///$1 [L,R=301]
RewriteCond %{http_host} ^777zhaopin.cn [NC]
RewriteRule ^(.*)$ http:///$1 [L,R=301]
RewriteCond %{http_host} ^ [NC]
RewriteCond %{http_host} ^ [NC]
RewriteRule ^(.*)$ [L,R=301]
RewriteCond %{http_host} ^ [NC]
RewriteRule ^(.*)$ [L,R=301]
RewriteCond %{http_host} ^777zp.cn [NC]
RewriteRule ^(.*)$ [L,R=301]
RewriteCond %{http_host} ^ [NC]
RewriteRule ^(.*)$ [L,R=301]
RewriteCond %{http_host} ^xn--315-yh6Fq51K.com [NC]
RewriteRule ^(.*)$ [L,R=301]
RewriteCond %{http_host} ^ [NC]
RewriteRule ^(.*)$ [L,R=301]
RewriteCond %{http_host} ^315zhaopin.com [NC]
RewriteRule ^(.*)$ [L,R=301]
RewriteCond %{http_host} ^xn--315-yh6Fq51K.xn--fiQs8S [NC]
RewriteRule ^(.*)$ [L,R=301]
RewriteCond %{http_host} ^ [NC]
RewriteRule ^(.*)$ [L,R=301]
RewriteCond %{http_host} ^ [NC]
RewriteRule ^(.*)$ [L,R=301]
添加一条 :
RewriteCond %{http_host} ^ [NC] :需要跳转的域名
RewriteRule ^(.*)$ /$1 [L,R=301] :主域名
保存退出
/etc/init.d/apachectl restart
重启服务器
阅读(4501) | 评论(0) | 转发(0) |