Explanation of rewrite pseudo-static law in Nginx (detailed)

Source: Internet
Author: User
This article introduces to you about Nginx in the rewrite pseudo-static rules of the explanation (detailed), there is a certain reference value, the need for friends can refer to, I hope to help you.

Trust now the big department with the Linux VPS Partners 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.phpId=$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 month 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, 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;# tagsrewrite ^/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;# maps file rewrite sitemap.xml sitemap.php last;# Self definition link 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;}}

Shopex enabling Pseudo-static

    ... Location/    {             if ' (!-e $request _filename) {             rewrite ^/(. *) $/index.php?$1 last;    }    } ......

1. Enable Pseudo-static

... # #begin Add by Guozhenbin 20100727 (with 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.