Nginx Rewrite Rules for Bo-blog 2.1.1 [original]

Source: Internet
Author: User

[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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.