[文章作者:张宴 本文版本:v1.1 最后修改:2009.12.01 转载请注明原文链接:http://blog.zyan.cc/bo-blog_nginx_rewrite/]

  Bo-Blog是一款采用PHP开发的单用户博客程序,本人的博客也采用的是Bo-Blog,个人觉得bo-blog的排版、易用性要比WordPress好得多,但扩展性不如WordPress。

  很多朋友向我询问过,Bo-Blog的Nginx Rewrite规则如何写。由于Bo-Blog官网只提供了Apache的Rewrite规则,这里,我将自己从 Bo-Blog 的 Apache Rewrite 规则转换而来的 Bo-Blog 2.1.1 的 Nginx Rewrite 重写规则贴在此处,供需要的朋友使用:
引用
   if (!-e $request_filename)
   {
      rewrite ^/post/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ /read.php?entryid=$1&page=$2&part=$3 last;
      rewrite ^/page/([0-9]+)/([0-9]+)/?$ /index.php?mode=$1&page=$2 last;
      rewrite ^/starred/([0-9]+)/?([0-9]+)?/?$ /star.php?mode=$1&page=$2 last;
      rewrite ^/category/([^/]+)/?([0-9]+)?/?([0-9]+)?/?$ /index.php?go=category_$1&mode=$2&page=$3 last;
      rewrite ^/archiver/([0-9]+)/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ /index.php?go=archive&cm=$1&cy=$2&mode=$3&page=$4 last;
      rewrite ^/date/([0-9]+)/([0-9]+)/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ /index.php?go=showday_$1-$2-$3&mode=$4&page=$5 last;
      rewrite ^/user/([0-9]+)/?$ /view.php?go=user_$1 last;
      rewrite ^/tags/([^/]+)/?([0-9]+)?/?([0-9]+)?/?$ /tag.php?tag=$1&mode=$2&page=$3 last;
      rewrite ^/component/id/([0-9]+)/?$ /page.php?pageid=$1 last;
      rewrite ^/component/([^/]+)/?$ /page.php?pagealias=$1 last;

      #Force redirection for old rules
      rewrite ^/read\.php/([0-9]+)\.htm$ http://$host/post/$1/ permanent;
      rewrite ^/post/([0-9]+)\.htm$ http://$host/post/$1/ permanent;
      rewrite ^/post/([0-9]+)\_([0-9]+)\.htm$ http://$host/post/$1/$2/ permanent;
      rewrite ^/post/([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/post/$1/$2/$3/ permanent;
      rewrite ^/index\_([0-9]+)\_([0-9]+)\.htm$ http://$host/page/$1/$2/ permanent;
      rewrite ^/star\_([0-9]+)\_([0-9]+)\.htm$ http://$host/starred/$1/$2/ permanent;
      rewrite ^/category\_([0-9]+)\.htm$ http://$host/category/$1/ permanent;
      rewrite ^/category\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/category/$1/$2/$3/ permanent;
      rewrite ^/archive\_([0-9]+)\_([0-9]+)\.htm$ http://$host/archiver/$1/$2/ permanent;
      rewrite ^/archive\_([0-9]+)\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/archiver/$1/$2/$3/$4/ permanent;
      rewrite ^/showday\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/date/$1/$2/$3/ permanent;
      rewrite ^/showday\_([0-9]+)\_([0-9]+)\_([0-9]+)\_([0-9]+)\_([0-9]+)\.htm$ http://$host/date/$1/$2/$3/$4/$5/ permanent;

      #Filename alias
      rewrite ^/([a-zA-Z0-9_-]+)/?([0-9]+)?/?([0-9]+)?/?$ /read.php?blogalias=$1&page=$2&part=$3 last;
   }


  PS:2009-12-01修正一处错误,之前文章中的if (!-x更换为if (!-e




技术大类 » Web服务器 | 评论(74) | 引用(0) | 阅读(70976)
louis vuitton uk Email Homepage
2011-11-22 17:02
This louis vuitton uk for sale belongs to the sounding just what are termed as Louis Vuitton vintage best sellers, many other products and services for the reason that range appearing companies.You will easily notice the unfold zippers of this coach outlet store online. That is the decoration. There are some inside pockets for you as well. They are easy to match your clothes and to carry.Let us inspire your inner beauty with fine christian louboutin sale. Purse the elegance in bridal wedding. Enjoy the fashion.
louis vuitton uk Email Homepage
2011-11-22 17:03
This louis vuitton uk for sale belongs to the sounding just what are termed as Louis Vuitton vintage best sellers, many other products and services for the reason that range appearing companies.You will easily notice the unfold zippers of this coach outlet store online. That is the decoration. There are some inside pockets for you as well. They are easy to match your clothes and to carry.Let us inspire your inner beauty with fine christian louboutin sale. Purse the elegance in bridal wedding. Enjoy the fashion.
armani watches Email Homepage
2011-11-23 10:06
If you are looking for armani Bags, our armani watches Handbags Canada outlet store is your first choice. We promise Original Packing and Best Discount,3-5 Workdays To Your Door!If you buy bags and purses of the latest new designs from the louis vuitton outlet now, you can enjoy special discounts. What else are you waiting for?After you choose the right kind of plants and the size pot for the plant.
长春做网站 Email Homepage
2011-12-7 15:22
看了博主的文章真是受益匪浅,支持了!
wedding520 Email Homepage
2011-12-27 15:59
ワイドネックライン、'V'ネックやボートネックラインは、一般にキャップスリーブとドレスのために選ばれている。ボートスタイルのネックラインと幅広いネックラインのためには、オフショルダーのキャップスリーブを追加することができます。オフショルダーのウエディングドレスは、数年以来、結婚式の摩耗で人気のパターンになっても流行で、今日でもあります。カラードレス 格安.のこのスタイルで素敵に見える模様のオフショルダーの袖に行く同じシースのサテンからステッチ/オフショルダーのキャップスリーブの上に薄いと飾ったときに裾フレアのビットとシースのサテンのイブニングドレスとスパゲッティネックラインがすごい見えます。
长春网络公司 Email Homepage
2011-12-29 16:29
读了博主的文章 觉得非常不错 支持一下!
长春演艺策划 Email Homepage
2012-3-15 10:45
博主说的很好,很有道理
arthur
2012-4-28 09:48
RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

我改写成nginx
if (!-e $request_filename)
  {
     rewrite ^(.*)$  /index.php?url=$1 break ;
  }
但是没起到作用 ,这个是什么问题
jordan 4 cavs Email Homepage
2012-5-8 17:05
jordan 4 cavsShoes are released in lines, much as cars are marketed, with a higher heel on them. They are also many new styles of Puma sneakers. You can select sneakers in bold mixture of colors, peerless and high mileage.Find and share deals and reviews on Old Navy <a href"=http://www.airjordan4cavsretro.com">jordan 4 cavs</a>: Shoes for $9+, 20% OFF Adult Styles, 30% OFF Kids and Baby Summer Styles at dealspl.us. Oldnavy.gap.com offers this for Sale, $7/Free* shipping. LoveIt shared <a href="http://www.airjordan4cavsretro.com">retro 4 cavs</a> on May 07, 2012.
Hogan Email Homepage
2012-5-10 17:56
Mentre youre gestione di problemi complessi tra cui PAYE insieme con le imprese del prelievo, l'idea è sicuramente intelligente per acquisire specializzata fare qualcosa di sicuro si sta usando la vostra organizzazione. Self-employmentSelf lavoratori uomini e donne potrebbe anche fare pieno uso Hogan dei ragionieri in tutta Stansted, quando hanno l'effetto della loro prelievo unico e sì, è spesso sconcertante. Stare di fronte a una buona varietà prelievo può essere schiacciante, di conseguenza, il
hogan280 Email
2012-5-10 18:08
Finora, così tipico. Dei 17.000 casi di reati sessuali che coinvolgono bambini sotto i 16 anni solo 4000 è andato in tribunale lo scorso anno, secondo i CPS. Questo è poco meno di un quarto di tutti i casi segnalati. E secondo NSPCC di ricerca, un terzo (34%) dei bambini che vengono abusati sessualmente non dirlo a nessuno in tutto, per non parlare di segnalarlo alla polizia. Eppure il caso della adolescente e il Hogan negozio asporto controtendenza il trend statistico di questa settimana quando le prove della ragazza costituito una parte centrale del processo contro una banda di nove uomini, che sono stati condannati ciascuno a tra i quattro ei 19 anni dopo essere stato giudicato colpevole di 25 bambino reati sessuali, compreso lo stupro e il traffico.
道依茨 Email Homepage
2012-5-17 15:29
谢谢楼主分享,支持一下!
道依茨 Email Homepage
2012-6-2 10:08
谢谢博主分享,支持下http://www.nddeutz.com
gaozi
2012-8-11 13:58
red bottom shoes Email Homepage
2012-11-9 16:34
http://www.red-bottom-shoes-2012.com
理白 Homepage
2014-7-15 09:24
我现在的网站  已使用成功,特来感谢张老师!
Steven Email Homepage
2015-3-19 02:46
Thank you for this post Weight Loss Tea
分页: 3/4 第一页 上页 1 2 3 4 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]