Bo-Blog 2.1.1在Nginx下的Rewrite规则无错版,支持别名

# server
{
listen 80;
server_name 域名;
index index.html index.htm index.php;
root 网站目录;
error_page 404 /404.html;
fastcgi_intercept_errors on;

   if (!-e $request_filename)
   {
      rewrite ^/post/([0-9>+)/?([0-9>+)?/?([0-9>+)?/?$ /read.php?entryid=$1&page=$2&part=$3 last;
      rewrite ^/page/([0-9>+)/([0-9>+)/?$ /index.php?mode=$1&page=$2 last;
      rewrite ^/starred/([0-9>+)/?([0-9>+)?/?$ /star.php?mode=$1&page=$2 last;
      rewrite ^/category/([^/>+)/?([0-9>+)?/?([0-9>+)?/?$ /index.php?go=category_$1&mode=$2&page=$3 last;
      rewrite ^/archiver/([0-9>+)/([0-9>+)/?([0-9>+)?/?([0-9>+)?/?$ /index.php?go=archive&cm=$1&cy=$2&mode=$3&page=$4 last;
      rewrite ^/date/([0-9>+)/([0-9>+)/([0-9>+)/?([0-9>+)?/?([0-9>+)?/?$ /index.php?go=showday_$1-$2-$3&mode=$4&page=$5 last;
      rewrite ^/user/([0-9>+)/?$ /view.php?go=user_$1 last;
      rewrite ^/tags/([^/>+)/?([0-9>+)?/?([0-9>+)?/?$ /tag.php?tag=$1&mode=$2&page=$3 last;
      rewrite ^/component/id/([0-9>+)/?$ /page.php?pageid=$1 last;
      rewrite ^/component/([^/>+)/?$ /page.php?pagealias=$1 last;
      #Force redirection for old rules
      rewrite ^/read\.php/([0-9>+)\.htm$ http://$host/post/$1/ permanent;
      rewrite ^/post/([0-9>+)\.htm$ http://$host/post/$1/ permanent;
      rewrite ^/post/([0-9>+)\_([0-9>+)\.htm$ http://$host/post/$1/$2/ permanent;
      rewrite ^/post/([0-9>+)\_([0-9>+)\_([0-9>+)\.htm$ http://$host/post/$1/$2/$3/ permanent;
      rewrite ^/index\_([0-9>+)\_([0-9>+)\.htm$ http://$host/page/$1/$2/ permanent;
      rewrite ^/star\_([0-9>+)\_([0-9>+)\.htm$ http://$host/starred/$1/$2/ permanent;
      rewrite ^/category\_([0-9>+)\.htm$ http://$host/category/$1/ permanent;
      rewrite ^/category\_([0-9>+)\_([0-9>+)\_([0-9>+)\.htm$ http://$host/category/$1/$2/$3/ permanent;
      rewrite ^/archive\_([0-9>+)\_([0-9>+)\.htm$ http://$host/archiver/$1/$2/ permanent;
      rewrite ^/archive\_([0-9>+)\_([0-9>+)\_([0-9>+)\_([0-9>+)\.htm$ http://$host/archiver/$1/$2/$3/$4/ permanent;
      rewrite ^/showday\_([0-9>+)\_([0-9>+)\_([0-9>+)\.htm$ http://$host/date/$1/$2/$3/ permanent;
      rewrite ^/showday\_([0-9>+)\_([0-9>+)\_([0-9>+)\_([0-9>+)\_([0-9>+)\.htm$ http://$host/date/$1/$2/$3/$4/$5/ permanent;
      #Filename alias
      rewrite ^/([a-zA-Z0-9_->+)/?([0-9>+)?/?([0-9>+)?/?$ /read.php?blogalias=$1&page=$2&part=$3 last;
   }

评论列表

此文章还没有评论。