亚洲精品日韩欧美_欧美二区乱c少妇_中文字幕日韩在线播放_日韩不卡中文字幕

English |
  • 美國(guó)VPS主機(jī)推薦
  • |
  • 代購(gòu)服務(wù)
  • |
  • 10美元以下VPS
  • |
  • VPS新手指南/教程
  • |
  • 留言板
  • |
  • 關(guān)于
  • | 登錄 |

    LNMP/Nginx常用Rewrite(偽靜態(tài)規(guī)則)WordPress/Discuz/DiscuzX/PHPWind/Typecho/codeigniter/laravel/thinkphp/drupal

    2009年08月6日 下午 | 作者:VPS偵探

    相信現(xiàn)在大部分用Linux VPS的朋友都在使用這個(gè)迅速傳播的Nginx或LNMP一鍵安裝包(lnmp安裝包已經(jīng)自帶了下面大部分偽靜態(tài)規(guī)則),Nginx和Apache的偽靜態(tài)是不一樣的,今天就整理一下最常見(jiàn)的PHP程序的nginx Rewrite(偽靜態(tài)規(guī)則)。目前已收集Wordpress、Wordpress二級(jí)目錄、Discuz、Discuz X、PHPWind、Typecho、codeiginiter/thinkphp/laravel/yii2框架、drupal、DEDECMS、PHPCMS、ECSHOP、ShopEX、SaBlog:

    WordPress:

    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    # Add trailing slash to */wp-admin requests.
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    WordPress在二級(jí)目錄:

    location /wp/ {
    try_files $uri $uri/ /wp/index.php?$args;
    }

    # Add trailing slash to */wp-admin requests.
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    里面的wp改成你的二級(jí)目錄名稱(chēng)

    Discuz:

    location / {
    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;
    }

    Discuz X:

    rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
    rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
    rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
    rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
    rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
    rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
    rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
    rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
    rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
    if (!-e $request_filename) {
    return 404;
    }

    Discz X在二級(jí)目錄下運(yùn)行:
    location /bbs/ {
    rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
    rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
    rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
    rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
    rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
    rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
    rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
    rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
    rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
    if (!-e $request_filename) {
    return 404;
    }
    }
    上面bbs更改為自己的二級(jí)目錄名

    Typecho:

    if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php$1 last;
    }

    Typecho在二級(jí)目錄下運(yùn)行:
    location /typecho/ {
    if (!-e $request_filename) {
    rewrite ^(.*)$ /typecho/index.php$1 last;
    }
    }

    PHPWind:

    location / {
    rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
    rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;
    }


    codeigniter框架:
    location / {
    try_files $uri $uri/ /index.php;
    }
    thinkphp框架:
    location / {
    if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php?s=/$1 last;
    break;
    }
    }
    laravel框架:
    location / {
    try_files $uri $uri/ /index.php?$query_string;
    }
    yii2框架:
    location / {
    try_files $uri $uri/ /index.php$is_args$args;
    }

    drupal:
    if (!-e $request_filename) {
    rewrite ^/(.*)$ /index.php?q=$1 last;
    }

    joomla:
    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    PHPCMS:
    location / {
    rewrite ^/caipu-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3 last;
    rewrite ^/content-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3 last;
    rewrite ^/list-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=lists&catid=$1&page=$2 last;
    rewrite ^/tag-([^\.]*)-([0-9]+)-([0-9]+).html /index.php?m=content&c=tag&catid=$2&tag=$1&page=$3 last;
    rewrite ^/comment-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=comment&c=index&a=init&commentid=content_$1-$2-$3 last;
    rewrite ^/([^\.]*).html /index.php?m=member&c=index&a=$1 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:(感謝追尋36[正冰]博客提供)

    # 只帶月份的歸檔
    rewrite "^/date/([0-9]{6})/?([0-9]+)?/?$" /index.php?action=article&setdate=$1&page=$2 last;
    # 無(wú)分類(lèi)翻頁(yè)
    rewrite ^/page/([0-9]+)?/?$ /index.php?action=article&page=$1 last;
    # 分類(lèi)
    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;
    # 歸檔、高級(jí)搜索
    rewrite ^/(archives|search|article|links)/?$ /index.php?action=$1 last;
    # 全部評(píng)論、標(biāo)簽列表、引用列表 帶分頁(yè)
    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;
    # 文章
    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;
    # 用戶(hù) 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;
    # 地圖文件
    rewrite sitemap.xml sitemap.php last;
    # 自定義鏈接
    rewrite ^(.*)/([0-9a-zA-Z\-\_]+)/?([0-9]+)?/?$ $1/index.php?action=show&alias=$2&page=$3 last;

    DEDECMS:

    location / {
    rewrite "^/index.html$" /index.php last;
    rewrite "^/list-([0-9]+)\.html$" /plus/list.php?tid=$1 last;
    rewrite "^/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$" /plus/list.php?tid=$1&totalresult=$2&PageNo=$3 last;
    rewrite "^/view-([0-9]+)-1\.html$" /plus/view.php?arcID=$1 last;
    rewrite "^/view-([0-9]+)-([0-9]+)\.html$" /plus/view.php?aid=$1&pageno=$2 last;
    rewrite "^/tags.html$" /tags.php last;
    rewrite "^/tag-([0-9]+)-([0-9]+)\.html$" /tags.php?/$1/$2/ last;
    break;
    }

    今天暫時(shí)整理這些,以后不定期更新。

    >>轉(zhuǎn)載請(qǐng)注明出處:VPS偵探 本文鏈接地址:http://www.0794baidu.com/manage/nginx-rewrite.html
    VPS偵探推薦:
    遨游主機(jī)VultrLinode搬瓦工LOCVPSKVMLAHOSTKVMHostXen80VPS美國(guó)VPS主機(jī),國(guó)內(nèi)推薦騰訊云阿里云

    發(fā)表評(píng)論

    *必填

    *必填 (不會(huì)被公開(kāi))

    評(píng)論(8條評(píng)論)

    1. VPSer說(shuō)道:

      @qloog, 主題:UCDCHINA 沒(méi)用評(píng)論插件

    2. qloog說(shuō)道:

      請(qǐng)問(wèn) 用的是 什么 主題? 什么評(píng)論插件! 感覺(jué)不錯(cuò)! 謝謝!

    3. VPSer說(shuō)道:

      @翔云, nginx.conf文件在vps/usr/local/nginx/conf。偽靜態(tài)單獨(dú)放在/usr/local/nginx/conf下面創(chuàng)建一個(gè)文件,如discuz.conf,在虛擬主機(jī)server段里直接include discuz.conf; 重啟nginx即可。如果不會(huì)弄的話/root/vhost.sh 添加吧。

    4. 翔云說(shuō)道:

      我留言中的地址,想搞偽靜態(tài),不知道把nginx.conf文件放在vps的那個(gè)目錄,是這個(gè)嗎?/usr/local/nginx/conf,如果是,這里面已經(jīng)有了nginx.conf,我在這個(gè)VPS綁定了幾個(gè)域名,那么不同的偽靜態(tài)規(guī)則怎么和域名對(duì)應(yīng)呢?還是將偽靜態(tài)規(guī)則放在域名對(duì)應(yīng)的文件夾下面,謝謝!我是小白,請(qǐng)不吝賜教! ?? ??

    5. im502說(shuō)道:

      博主好,我想把威視CC遷移到nginx上,但是rewrite規(guī)則總是不成功,能否幫我看一下,下面是原來(lái)的規(guī)則:
      RewriteEngine On

      RewriteCond %{REQUEST_FILENAME} \.(html|jpg|gif|jpeg|js|css|png|swf|sql|xml|txt)$
      RewriteRule . - [PT,L]

      RewriteRule ^(api/|admin\.php|index\.php|favicon\.ico) - [PT,L]
      RewriteRule ^(system) - [F,L]
      RewriteRule .* index.php/$0 [PT,L]

    6. 花樣年華說(shuō)道:

      shopex4.8的好像還要改一個(gè)文件,后臺(tái)才能設(shè)置

    7. VPSer說(shuō)道:

      呵呵,謝謝分享

    8. 正冰說(shuō)道:

      在nginx上配置Sa-Blog2.0rewrite規(guī)則,見(jiàn)http://blog.is36.cn/SaBlog2_discuz7_rewrite_rule_at_nginx/,因?yàn)橐?guī)則代碼太多,就不占地兒了,想必有人需要的吧。

    主站蜘蛛池模板: 国产精品揄拍500视频| 欧美精品国产精品久久久| 国产美女搞久久| 日韩中文字幕在线不卡| 欧美精品在线播放| 日本精品中文字幕| 久久婷婷国产精品| 国产日韩av高清| 国产日韩一区欧美| 国产精品日韩精品| 亚洲免费久久| 国产精品99久久久久久久| 一本久久a久久精品vr综合| 日韩wumaV| 国产精品美女免费看| 日韩中文字幕二区| 美日韩精品免费视频| 啊v视频在线一区二区三区| 伊人久久99| 久久久国产视频| 亚洲综合在线做性V| 久久久国产影院| 色综合色综合网色综合| 久久久999国产精品| 日韩在线中文视频| 国产精品网站免费| 福利视频久久| 久久资源免费视频| 岛国一区二区三区高清视频| 欧美在线一级va免费观看| 国产精品揄拍500视频| 日韩精品大片| 国产精品成人av性教育| 欧美日韩高清在线观看| 91国产美女在线观看| 国产日韩欧美影视| 欧美一级片中文字幕| 一级日韩一区在线观看| 国产精品一香蕉国产线看观看| 日产国产精品精品a∨| 不卡av在线播放|