Bo-Blog 2.1.1 的 Nginx Rewrite 规则 不指定

   记得以前一个朋友用bo-blog做了一个博客,然后用的是nginx,在bo官方论坛一直寻求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;
   }


  在windows下如果你没有rewrite模块,可以像本博客一样用404.php实现伪静态!

作者:小华@小华生活
地址:http://www.boyhua.net/post/402/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最新日志 随机日志 综合排行
你真的如“农民工”吗...
备份数据还是用帝国备...
网易靓号你会买吗?
2010年8月15日...
为什么很多人对“老师...
收藏一款帝国下载的电...
转:百度日本贴吧上线
常用国外域名注册商优...
转载:“糟蹋”的20...
剑网行动-打击网络侵...
dnspod注册需要...
我觉得很多人都在被营...
资料:市政知识汇总
备案神速
研究生入学考试开考,...
5月19日至21日为...
今天又看到了比较PW...
镇江消防支队抗震救灾...
2009年一级建造师...
最近很火的活动—百奥...
韩雪在闭幕式上衣服掉...
pw蓝冰被解封
网页颜色变黑白代码-...
360也出杀毒软件!
windows7(w...
NBA赛程2009-...
天正建筑8.0注册机...
邮箱-Godaddy...
刚看了最新的电影叶问...
PHPWind Fo...
winrar软件注册...
丫的,米振涛这骗子又...
韩雪在闭幕式上衣服掉...
谈到GG作弊,内有重...
phpwind(pw...
私人日志
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]