Common rewrite pseudo-static law of Nginx

Source: Internet
Author: User

Trust now the big department with the Linux VPS partner are using this agile spread nginx, this day to liquidate the most common PHP French 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 law
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 law
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:

# Archive with only months
Rewrite "^/date/([0-9]{6})/? ([0-9]+)/?$ "/index.php?action=article&setdate=$1&page=$2 last;
# no category page
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, Advanced raid
Rewrite ^/(archives|search|article|links)/?$/index.php?action=$1 last;
# full criticism, tag list, citation 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;
# Articles
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;
# maps File
Rewrite Sitemap.xml sitemap.php last;
# self-Definition 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 Shopex enabling 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

......

Common rewrite pseudo-static law of Nginx

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.