Some domestic common PHP cms nginx server's pseudo static rule collation _nginx

Source: Internet
Author: User
Tags nginx server
But many netizens still do not understand Nginx server's pseudo static rule very much, and if you install is some commonly used program, like Wordpress,phpcms,ecshop,shopex,discuz 7, that pseudo static rule has ready-made. In order to facilitate the webmaster, collected these several common procedures of the pseudo static rules.
WordPress pseudo Static Rules
Copy Code code as follows:

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 pseudo Static Rules
Copy Code code as follows:

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 pseudo Static Rules
Copy Code code as follows:

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 pseudo Static Rules
Copy Code code as follows:

Location/{
if (!-e $request _filename) {
Rewrite ^/(. +\. ( html|xml|json|htm|php|jsp|asp|shtml)) $/index.php?$1 last;
}
}

Discuz 7 pseudo-static rules
Copy Code code as follows:

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;

Author: Zhu Maohai

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.