第一步:修改.htaccess文件,因为apache的rewrite转向规则跟nginx的转向规则还是有一些不一样的,典型的不一样有nginx的根目录需要写在每行转向的地址前,每行规则必须以分号(;)结束,301或者404等跳转使用不同的格式。
RewriteEngine On
RewriteBase /
RewriteRule ^show-([0-9]+)-([0-9]+)\.html$ index.
php?action=show&id=$1&page=$2
RewriteRule ^category-([0-9]+)-([0-9]+)\.html$ index.php?action=index&cid=$1&page=$2
RewriteRule ^archives-([0-9]+)-([0-9]+)\.html$ index.php?action=index&setdate=$1&page=$2
RewriteRule ^(archives|search|reg|login|index|links)\.html$ index.php?action=$1
RewriteRule ^(comments|tagslist|trackbacks|index)-([0-9]+)\.html$ index.php?action=$1&page=$2
rewriteCond %{http_host} ^jbxue.com [NC]
rewriteRule ^(.*)$
http://www.jbxue.com/$1 [R=301,L]
ErrorDocument 404
http://www.jbxue.com/rewrite ^/show-([0-9]+)-([0-9]+)\.html$ /index.php?action=show&id=$1&page=$2;
rewrite ^/category-([0-9]+)-([0-9]+)\.html$ /index.php?action=index&cid=$1&page=$2;
rewrite ^/archives-([0-9]+)-([0-9]+)\.html$ /index.php?action=index&setdate=$1&page=$2;
rewrite ^/(archives|search|reg|login|index|links)\.html$ /index.php?action=$1;
rewrite ^/(comments|tagslist|trackbacks|index)-([0-9]+)\.html$ /index.php?action=$1&page=$2;
if ($host != '
www.jbxue.com' ) {
rewrite ^/(.*)$
http://www.jbxue.com/$1 permanent;
}
error_page 404
http://www.jbxue.com/;