linux 维护优化 & 技术 26 Oct 2007 10:18 am
apache 转向
恭喜公司.com再此被百度收录。
网站改版后,由于目录和文件命名的改变,以前收录的URL就是404了,现需转发至资料备份服务器。
使用php的话效率低了,所以用apache直接转发。
- #笨方法
- #Redirect temp /doc/ http://222.222.222.222/doc/
- #Redirect temp /news/ http://222.222.222.222/news/
- #Redirect temp /parttimetalent/ http://222.222.222.222/parttimetalent/
- #Redirect temp /fulltimetalent/ http://222.222.222.222/fulltimetalent/
- #Redirect temp /person/ http://222.222.222.222/person/
- #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