linux 维护优化 & 技术 26 Oct 2007 10:18 am

apache 转向

恭喜公司.com再此被百度收录。
网站改版后,由于目录和文件命名的改变,以前收录的URL就是404了,现需转发至资料备份服务器。
使用php的话效率低了,所以用apache直接转发。

  1. #笨方法
  2. #Redirect temp /doc/ http://222.222.222.222/doc/
  3. #Redirect temp /news/ http://222.222.222.222/news/
  4. #Redirect temp /parttimetalent/ http://222.222.222.222/parttimetalent/
  5. #Redirect temp /fulltimetalent/ http://222.222.222.222/fulltimetalent/
  6. #Redirect temp /person/ http://222.222.222.222/person/
  7. #Redirect temp /ebook/ http://222.222.222.222/ebook/

#使用正则
RedirectMatch temp ^/(doc|news|parttimetalent|fulltimetalent|person|ebook)/(.*) http://222.222.222.222/$1/$2

#反向代理;对图片、js等目录都需处理,比较麻烦
#需开启proxy_module和proxy_http_module,费资源
#ProxyPass /doc/ http://222.222.222.222/doc/
#ProxyPass /Include/ http://222.222.222.222/Include/
#ProxyPassReverse /doc/ http://222.222.222.222/doc/

关于在转向时使用301还是302,可以参考
http://www.chinamyhosting.com/seoblog/2006/04/12/301-redirect/

如果想收录新站就用301,保持原站索引用302

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply