Nginx common rewrite pseudo-static rules

Source: Internet
Author: User

Trust that most of the Linux VPs partners are using this agile deployment nginx. This day, we will clear the most common PHP rewrite (pseudo static Law ).

WordPress:

Location /{
Index index.html index. php;
If (-F $ request_filename/index.html ){
Rewrite (. *) $1/index.html break;
}
If (-F $ request_filename/index. php ){
Rewrite (. *) $1/index. php;
}
If (! -F $ request_filename ){
Rewrite (. *)/index. php;
}
}

Phpcms:

Location /{
### Phpcms pseudo-static Rewrite Rules
Rewrite ^ (. *) show-([0-9] +)-([0-9] +) \. html $1/show. php? Itemid = $2 & page = $3;
Rewrite ^ (. *) List-([0-9] +)-([0-9] +) \. html $1/list. php? Catid = $2 & page = $3;
Rewrite ^ (. *) show-([0-9] +) \. html $1/show. php? Specialid = $2;

#### Phpwind pseudo-static Rewrite Rules
Rewrite ^ (. *)-HTM-(. *) $ 1.php? $2 last;
Rewrite ^ (. *)/simple/([a-z0-9 \ _] + \. html) $1/simple/index. php? $2 last;
}

Ecshop:

If (! -E $ request_filename)
{
Rewrite "^/Index \. html"/index. php last;
Rewrite "^/category $"/index. php last;
Rewrite "^/feed-C ([0-9] +) \. xml $"/feed. php? Cat = $1 last;
Rewrite "^/feed-B ([0-9] +) \. xml $"/feed. php? Brand = $1 last;
Rewrite "^/feed \. xml $"/feed. php last;
Rewrite "^/category-([0-9] +)-B ([0-9] +)-min ([0-9] +) -Max ([0-9] +)-ATTR ([^-] *)-([0-9] + )-(. +)-([A-Za-Z] + )(. *)\. HTML $ "/category. PHP? Id = $1 & brand = $2 & price_min = $3 & price_max = $4 & filter_attr = $5 & page = $6 & sort = $7 & Order = $8 last;
Rewrite "^/category-([0-9] +)-B ([0-9] +)-min ([0-9] +) -Max ([0-9] +)-ATTR ([^-] *) (. *)\. HTML $ "/category. PHP? Id = $1 & brand = $2 & price_min = $3 & price_max = $4 & filter_attr = $5 last;
Rewrite "^/category-([0-9] +)-B ([0-9] +)-([0-9] + )-(. +)-([A-Za-Z] + )(. *)\. HTML $ "/category. PHP? Id = $1 & brand = $2 & page = $3 & sort = $4 & Order = $5 last;
Rewrite "^/category-([0-9] +)-B ([0-9] +)-([0-9] + )(. *)\. HTML $ "/category. PHP? Id = $1 & brand = $2 & page = $3 last;
Rewrite "^/category-([0-9] +)-B ([0-9] +) (. *) \. html $"/category. php? Id = $1 & brand = $2 last;
Rewrite "^/category-([0-9] +) (. *) \. html $"/category. php? Id = $1 last;
Rewrite "^/goods-([0-9] +) (. *) \. html"/goods. php? Id = $1 last;
Rewrite "^/article_cat-([0-9] +)-([0-9] + )-(. +)-([A-Za-Z] + )(. *)\. HTML $ "/article_cat.php? Id = $1 & page = $2 & sort = $3 & Order = $4 last;
Rewrite "^/article_cat-([0-9] +)-([0-9] +) (. *) \. html $"/article_cat.php? Id = $1 & page = $2 last;
Rewrite "^/article_cat-([0-9] +) (. *) \. html $"/article_cat.php? Id = $1 last;
Rewrite "^/Article-([0-9] +) (. *) \. html $"/Article. php? Id = $1 last;
Rewrite "^/brand-([0-9] +)-C ([0-9] +)-([0-9] + )-(. +)-([A-Za-Z] + )\. html "/brand. PHP? Id = $1 & cat = $2 & page = $3 & sort = $4 & Order = $5 last;
Rewrite "^/brand-([0-9] +)-C ([0-9] +)-([0-9] + )(. *)\. html "/brand. PHP? Id = $1 & cat = $2 & page = $3 last;
Rewrite "^/brand-([0-9] +)-C ([0-9] +) (. *) \. html"/brand. php? Id = $1 & cat = $2 last;
Rewrite "^/brand-([0-9] +) (. *) \. html"/brand. php? Id = $1 last;
Rewrite "^/Tag-(. *) \. html"/search. php? KEYWORDS = $1 last;
Rewrite "^/snatch-([0-9] +) \. html $"/snatch. php? Id = $1 last;
Rewrite "^/group_buy-([0-9] +) \. html $"/group_buy.php? Act = view & id = $1 last;
Rewrite "^/auction-([0-9] +) \. html $"/auction. php? Act = view & id = $1 last;
Rewrite "^/exchange-ID ([0-9] +) (. *) \. html $"/exchange. php? Id = $1 & act = view last;
Rewrite "^/exchange-([0-9] +)-min ([0-9] +)-max ([0-9] +) -([0-9] + )-(. +)-([A-Za-Z] + )(. *)\. HTML $ "/exchange. PHP? Cat_id = $1 & integral_min = $2 & integral_max = $3 & page = $4 & sort = $5 & Order = $6 last;
Rewrite ^/exchange-([0-9] +)-([0-9] + )-(. +)-([A-Za-Z] + )(. *)\. HTML $ "/exchange. PHP? Cat_id = $1 & page = $2 & sort = $3 & Order = $4 last;
Rewrite "^/exchange-([0-9] +)-([0-9] +) (. *) \. html $"/exchange. php? Cat_id = $1 & page = $2 last;
Rewrite "^/exchange-([0-9] +) (. *) \. html $"/exchange. php? Cat_id = $1 last;
}

Shopex:

Location /{
If (! -E $ request_filename ){
Rewrite ^/(. + \. (HTML | XML | JSON | HTM | PHP | JSP | ASP | shtml) $/index. php? $1 last;
}
}

Sablog 2.0:

# Archiving with only months
Rewrite "^/date/([0-9] {6 })/? ([0-9] + )? /? $ "/Index. php? Action = article & setdate = $1 & page = $2 last;
# No category Paging
Rewrite ^/page/([0-9] + )? /? $/Index. php? Action = article & page = $1 last;
# Category
Rewrite ^/category/([0-9] + )/? ([0-9] + )? /? $/Index. php? Action = article & cid = $1 & page = $2 last;
Rewrite ^/category/([^/] + )/? ([0-9] + )? /? $/Index. php? Action = article & curl = $1 & page = $2 last;
# Archive and Advanced Search
Rewrite ^/(archives | search | Article | links )/? $/Index. php? Action = $1 last;
# Full-data criticism, tag list, and reference list with pagination
Rewrite ^/(comments | tagslist | trackbacks | article )/? ([0-9] + )? /? $/Index. php? Action = $1 & page = $2 last;
# Tags
Rewrite ^/Tag/([^/] + )/? ([0-9] + )? /? $/Index. php? Action = article & item = $1 & page = $2 last;
# Article
Rewrite ^/archives/([0-9] + )/? ([0-9] + )? /? $/Index. php? Action = show & id = $1 & page = $2 last;
# RSS rewrite ^/RSS/([0-9] + )? /? $/RSS. php? Cid = $1 last;
Rewrite ^/RSS/([^/] + )/? $/RSS. php? Url = $1 last;
# User rewrite ^/UID/([0-9] + )/? ([0-9] + )? /? $/Index. php? Action = article & uid = $1 & page = $2 last;
Rewrite ^/user/([^/] + )/? ([0-9] + )? /? $/Index. php? Action = article & User = $1 & page = $2 last;
# Map Files
Rewrite sitemap. xml sitemap. php last;
# Custom links
Rewrite ^ (. *)/([0-9a-za-z \-\ _] + )/? ([0-9] + )? /? $1/index. php? Action = show & alias = $2 & page = $3 last;

Discuz 7:

Rewrite ^/archiver/(FID | tid)-[\ W \-] + \. html) $/archiver/index. php? $1 last;
Rewrite ^/Forum-([0-9] +)-([0-9] +) \. html $/Forumdisplay. php? FID = $1 & page = $2 last;
Rewrite ^/thread-([0-9] +)-([0-9] +)-([0-9] +) \. html $/viewthread. php? Tid = $1 & extra = Page \ % 3d $3 & page = $2 last;
Rewrite ^/space-(username | UID)-(. +) \. html $/space. php? $1 = $2 last;
Rewrite ^/Tag-(. +) \. html $/Tag. php? Name = $1 last;

Typecho:

Location /{
Index index.html index. php;
If (-F $ request_filename/index.html ){
Rewrite (. *) $1/index.html break;
}
If (-F $ request_filename/index. php ){
Rewrite (. *) $1/index. php;
}
If (! -F $ request_filename ){
Rewrite (. *)/index. php;
}
}

4.8.5 shopexEnable pseudo-static

......

Location/

{

If (! -E $ request_filename ){

Rewrite ^/(. *) $/index. php? $1 last;

}

}

......

 

1.Enable pseudo-static

......

# Begin add by guozhenbin 20100727 (use pseudo-static)

Location/

{

If (! -E $ request_filename ){

Rewrite ^/(. *) $/index. php? $1 last;

}

}

# End add by guozhenbin 20100727

......

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.