國內(nèi)一些常用PHP的CMS的Nginx服務(wù)器的偽靜態(tài)規(guī)則整理
WordPress偽靜態(tài)規(guī)則
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偽靜態(tài)規(guī)則
location / {
###以下為PHPCMS 偽靜態(tài)化rewrite規(guī)則
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 偽靜態(tài)化rewrite規(guī)則
rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;
}
ECSHOP偽靜態(tài)規(guī)則
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偽靜態(tài)規(guī)則
location / {
if (!-e $request_filename) {
rewrite ^/(.+\.(html|xml|json|htm|php|jsp|asp|shtml))$ /index.php?$1 last;
}
}
Discuz 7偽靜態(tài)規(guī)則
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;
作者:朱茂海
- nginx 偽靜態(tài)化rewrite規(guī)則
- nginx rewrite 偽靜態(tài)配置參數(shù)詳細(xì)說明
- nginx rewrite 偽靜態(tài)配置參數(shù)和使用例子
- Nginx下WordPress鏈接(url偽靜態(tài))301永久重定向?qū)崿F(xiàn)方法
- Nginx下讓W(xué)ordPress支持固定鏈接的偽靜態(tài)規(guī)則
- Nginx偽靜態(tài)配置和常用Rewrite偽靜態(tài)規(guī)則集錦
- PHP開發(fā)框架kohana3.3.1在nginx下的偽靜態(tài)設(shè)置例子
- nginx支持.htaccess文件實(shí)現(xiàn)偽靜態(tài)的方法分享
相關(guān)文章
nginx開啟HSTS讓瀏覽器強(qiáng)制跳轉(zhuǎn)HTTPS訪問詳解
這篇文章主要介紹了nginx開啟HSTS讓瀏覽器強(qiáng)制跳轉(zhuǎn)HTTPS訪問詳解,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2019-05-05
深入解析nginx路由location匹配規(guī)則及其優(yōu)先級
Nginx是一款高性能的Web服務(wù)器和反向代理服務(wù)器,它的路由功能是通過location指令來實(shí)現(xiàn)的,location指令用于匹配請求的URL,并將請求轉(zhuǎn)發(fā)到相應(yīng)的處理程序或靜態(tài)文件,需要的朋友可以參考下2023-10-10
Crontab+Shell做Nginx日志切割腳本實(shí)例代碼
本篇文章主要介紹了Crontab+Shell做Nginx日志切割腳本實(shí)例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-05-05
Nginx設(shè)置HttpOnly Secure SameSite參數(shù)解決Cookie信息丟失
本文主要介紹了Nginx中Cookie缺少SameSite屬性的問題,并詳細(xì)解釋了HttpOnly、Secure和SameSite屬性的作用,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2024-11-11
nginx 配置靜態(tài)緩存及靜態(tài)緩存文件沒有生成的問題及解決方案
這篇文章主要介紹了nginx 配置靜態(tài)緩存及靜態(tài)緩存文件沒有生成的問題及解決方案,本文分步驟結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下2023-11-11
解決Nginx配置靜態(tài)資源文件404 Not Found問題
在使用Nginx作為靜態(tài)資源服務(wù)器時(shí),如果配置了根目錄root導(dǎo)致404錯誤,而使用前綴URL配置alias則需要正確處理目錄路徑,使用alias時(shí)要確保目錄名后加‘/’,并且在需要時(shí)使用root和alias配置,本文介紹Nginx配置靜態(tài)資源文件404 Not Found問題解決方法,感興趣的朋友一起看看吧2025-03-03
nginx將https協(xié)議反向代理到http協(xié)議請求上的實(shí)現(xiàn)
本文主要介紹了nginx將https協(xié)議反向代理到http協(xié)議請求上的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-10-10
基于nginx的靜態(tài)網(wǎng)頁部署的實(shí)現(xiàn)
這篇文章主要介紹了基于nginx的靜態(tài)網(wǎng)頁部署的實(shí)現(xiàn),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-06-06
keepalived+nginx實(shí)現(xiàn)雙服務(wù)器主備方案
本文主要介紹了使用keepalived和nginx實(shí)現(xiàn)雙服務(wù)器主備方案,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2024-12-12

