Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2897871
  • 博文数量: 454
  • 博客积分: 4860
  • 博客等级: 上校
  • 技术积分: 6375
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-13 10:08
个人简介

10年工作经验,专研网站运维。

文章分类

全部博文(454)

文章存档

2017年(11)

2016年(13)

2015年(47)

2014年(36)

2013年(147)

2012年(64)

2011年(136)

分类: LINUX

2011-10-12 18:15:55

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
重启服务器
阅读(4433) | 评论(0) | 转发(0) |
0

上一篇:共享服务器

下一篇:DNS的spf记录

给主人留下些什么吧!~~