Bo-blog IIS Nginx Rewrite伪静态规则

适用于:bo-blog2.X以上版本  Windows IIS站点主机和Nginx主机

IIS ISAPI_Rewrite:

[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
#Bo-Blog 2.1.1 Release ISAPI_Rewrite https://www.fity.cn
RewriteRule ^(.*)/post/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/read\.php\?entryid=$2&page=$3&part=$4
RewriteRule ^(.*)/page/([0-9]+)/([0-9]+)/?$ $1/index\.php\?mode=$2&page=$3
RewriteRule ^(.*)/starred/([0-9]+)/?([0-9]+)?/?$ $1/star.php\?mode=$2&page=$3
RewriteRule ^(.*)/category/([^/]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/index\.php\?go=category_$2&mode=$3&page=$4
RewriteRule ^(.*)/archiver/([0-9]+)/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/index\.php\?go=archive&cm=$2&cy=$3&mode=$4&page=$5
RewriteRule ^(.*)/date/([0-9]+)/([0-9]+)/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/index\.php\?go=showday_$2-$3-$4&mode=$5&page=$6
RewriteRule ^(.*)/user/([0-9]+)/?$ $1/view\.php\?go=user_$2
RewriteRule ^(.*)/tags/([^/]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/tag\.php\?tag=$2&mode=$3&page=$4
RewriteRule ^(.*)/component/id/([0-9]+)/?$ $1/page\.php\?pageid=$2
RewriteRule ^(.*)/component/([^/]+)/?$ $1/page\.php\?pagealias=$2

#Customized URL
#RewriteRule ^(.*)/([^\/]*)\.html$ $1/$2/ [I]
RewriteRule ^(.*)/([^/|.]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/read.php\?blogalias=$2&page=$3&part=$4 [I]

#www.fity.cn伪RSS XML订阅页面
RewriteRule ^(.*)/rss.xml$ $1/feed\.php
RewriteRule ^(.*)/sitemap.xml$ $1/sitemap\.php



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

      #www.fity.cn伪RSS XML订阅页面
      rewrite ^/rss.xml$ /feed.php last;
      rewrite ^/sitemap.xml$ /sitemap.php last;
   }

相关文章

此处评论已关闭