[Author: Zhang banquet this article version: V1.1 final modification: 2009.12.01 reprinted please indicate the original article link: http://blog.s135.com/bo-blog_nginx_rewrite/]
Bo-blog is a single-user blog program developed using PHP. My blog also uses Bo-blog. I personally think it is much better to typeset and use Bo-blog than WordPress, but it is not as scalable as WordPress.
Many of my friends asked me how to write the nginx Rewrite Rules of Bo-blog. Since the bo-blog official website only provides Apache Rewrite Rules, here, I will paste the nginx rewrite rule of Bo-blog 2.1.1 converted from the Apache rewrite rule of Bo-blog here for the users who need it:
Reference 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;
}
PS: corrected an error. In the previous article, if (! -Replace X with if (! -E