域名的永久301跳转比较简单网上教程也很多,将没有3w的顶级域名yejianda.cn永久跳转到带3w的www.yejianda.cn上面。这么做的目的是因为有很多时候访客会输入没有3w的域名访问。然而今天晨风要分享的是关于老站的规则改新规则后,整站的老链接如何全部永久301跳转到新的链接上。

问题:

将整站www.xxxx.com/x.htm的页面跳转的新的伪静态规则www.xxxx.com/x.html

跳转之前的准备:

了解网站的结构,晨风操作的是一个结构比较简单的企业站,主要有以下结构:产品目录Product、新闻目录News、方案目录Faq、其它单页公司简介、联系方式等。

以目录为节点,编写永久301跳转规则,以linux服务器php5.2.X + apache2.X为例:

下面我们来编写下.htaccess文件。

RewriteEngine on
# 是否显示根目录下文件列表
Options -Indexes
RewriteBase /
RewriteRule ^(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.html
# Rewrite 系统规则请勿修改
RewriteRule ^index-([a-zA-Z0-9_^\x00-\xff]+).html$ index.php?lang=$1&pseudo_jump=1
RewriteRule ^([a-zA-Z0-9_^\x00-\xff]+)/list-([a-zA-Z0-9_^\x00-\xff]+)-([a-zA-Z0-9_^\x00-\xff]+).html$ $1/index.php?lang=$3&metid=$2&list=1&pseudo_jump=1
RewriteRule ^([a-zA-Z0-9_^\x00-\xff]+)/list-([a-zA-Z0-9_^\x00-\xff]+)-([0-9_]+)-([a-zA-Z0-9_^\x00-\xff]+).html$ $1/index.php?lang=$4&metid=$2&list=1&page=$3&pseudo_jump=1
RewriteRule ^([a-zA-Z0-9_^\x00-\xff]+)/jobcv-([a-zA-Z0-9_^\x00-\xff]+)-([a-zA-Z0-9_^\x00-\xff]+).html$ $1/cv.php?lang=$3&selectedjob=$2&pseudo_jump=1
RewriteRule ^([a-zA-Z0-9_^\x00-\xff]+)/product-list-([a-zA-Z0-9_^\x00-\xff]+).html$ $1/product.php?lang=$2&pseudo_jump=1
RewriteRule ^([a-zA-Z0-9_^\x00-\xff]+)/img-list-([a-zA-Z0-9_^\x00-\xff]+).html$ $1/img.php?lang=$2&pseudo_jump=1
RewriteRule ^([a-zA-Z0-9_^\x00-\xff]+)/([a-zA-Z0-9_^\x00-\xff^\x00-\xff]+)-([a-zA-Z0-9_^\x00-\xff]+).html$ $1/index.php?lang=$3&metid=$2&pseudo_jump=1
RewriteRule ^tag/([\s\S]+)-([a-zA-Z0-9_^\x00-\xff]+)$ search/search.php?class1=&class2=&class3=&searchtype=0&searchword=$1&lang=$2
# 单页301Product_list
RewriteRule ^product/product_7_1.htm(.*)$ product/list-7-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_389_1.htm(.*)$ product/list-389-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_389_418_1.htm(.*)$ product/list-418-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_389_419_1.htm(.*)$ product/list-419-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_389_417_1.htm(.*)$ product/list-417-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_389_398_1.htm(.*)$ product/list-398-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_389_520_1.htm(.*)$ product/list-520-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_398_386_1.htm(.*)$ product/list-386-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_389_478_1.htm(.*)$ product/list-478-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_398_479_1.htm(.*)$ product/list-479-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_398_401_1.htm(.*)$ product/list-401-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_389_480_1.htm(.*)$ product/list-480-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_462_1.htm(.*)$ product/list-462-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_462_421_1.htm(.*)$ product/list-421-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_421_1.htm(.*)$ product/list-421-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_462_420_1.htm(.*)$ product/list-420-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_462_422_1.htm(.*)$ product/list-422-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_462_435_1.htm(.*)$ product/list-435-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_462_423_1.htm(.*)$ product/list-423-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_462_434_1.htm(.*)$ product/list-434-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_508_1.htm(.*)$ product/list-508-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_512_1.htm(.*)$ product/list-512-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_496_497_1.htm(.*)$ product/list-496-cn.html$1 [R=301,L]
RewriteRule ^product/product_7_389_416_1.htm(.*)$ product/list-416-cn.html$1 [R=301,L]

跳转之后的处理:

J_@CGE0AHREY8QP~Q7[CF6V

反馈问题:

 

P{L)0AH%Q233@DT%)PUH(8S

站长平台并没有鸟我,但提交反馈至少可以推进此事进展。