蓝色航线博客系统伪静态设置方法

发表者:p 分类:使用帮助 发表于:2020-02-22 06:20:05 阅读[750] 评论[0] Tags:

Apache下伪静态设置规则

 

将以下规则复制到.htaccess文件中并上传到网站根目录,如果您网站放在blog目录,请将RewriteBase /改成相应RewriteBase /blog/

 

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^index.html$    index.php [L]

RewriteRule ^index/([0-9]+)/$ index.php?pg=$1 [L]

RewriteRule ^blog/([0-9]+)\.html$ blog.php?id=$1 [L]

RewriteRule ^category/([0-9]+)\.html$ list.php?act=cat_list&id=$1 [L]

RewriteRule ^category/([0-9]+)/([0-9]+)/$ list.php?act=cat_list&id=$1&pg=$2 [L]

RewriteRule ^archives/([0-9]+)/([0-9]+)/([0-9]+)/$ list.php?act=archives_list&date=$1/$2&pg=$3 [L]

RewriteRule ^archive/([0-9]+)/([0-9]+)/$ list.php?act=archives_list&date=$1/$2 [L]

RewriteRule ^category/(.*) list.php?act=cat_list&keywords=$1 [QSA,L]

RewriteRule ^page/(.*)/$ page.php?id=$1 [QSA,L]

RewriteRule ^tag/(.*)/$ tag.php?tag=$1 [QSA,L]

RewriteRule ^blog/(.*) blog.php?keywords=$1 [QSA,L]

 

 

Nginx下伪静态规则

 

 

if (!-e $request_filename)

{

    rewrite "^/index\.html" /index.php last;

    rewrite "^/index/([0-9]+)/$" /index.php?pg=$1 last;

    rewrite "^/blog/([0-9]+)\.html$" /blog.php?id=$1 last;

    rewrite "^/category/([0-9]+)/([0-9]+)/$" /list.php?act=cat_list&id=$1&pg=$2 last;

    rewrite "^/category/([0-9]+)\.html$" /list.php?act=cat_list&id=$1 last;

    rewrite "^/archives/([0-9]+)/([0-9]+)/([0-9]+)/$" /list.php?act=archives_list&date=$1/$2&pg=$3 last;

    rewrite "^/archive/([0-9]+)/([0-9]+)/$" /list.php?act=archives_list&date=$1/$2 last;

    rewrite "^/category/(.*)" /list.php?act=cat_list&keywords=$1 last;

    rewrite "^/tag/(.*)/$" /tag.php?tag=$1 last;

    rewrite "^/page/(.*)/$" /page.php?id=$1 last;

    rewrite "^/blog/(.*)" /blog.php?keywords=$1 last;

}

 

 

 

Lighttpd下伪静态规则

 

url.rewrite-once = (

"^/index\.html$" => "index.php",

"^/index/([0-9]+)/$" => "/index.php?pg=$1",

"^/blog/([0-9]+)\.html$" => "/blog.php?id=$1",

"^/category/([0-9]+)\.html$" => "/list.php?act=cat_list&id=$1",

"^/category/([0-9]+)/([0-9]+)/$" => "/list.php?act=cat_list&id=$1&pg=$2",

"^/archives/([0-9]+)/([0-9]+)/([0-9]+)/$" => "/list.php?act=archives_list&date=$1/$2&pg=$3",

"^/archive/([0-9]+)/([0-9]+)/$" => "/list.php?act=archives_list&date=$1/$2",

"^/category/(.*)$" =>  "/list.php?act=cat_list&keywords=$1",

"^/page/(.*)/$" => "page.php?id=$1",

"^/tag/(.*)/$" => "tag.php?tag=$1",

"^/blog/(.*)$" => "blog.php?keywords=$1"

)

 

 

 

IIS下伪静态规则

 

请将以下内容复制到httpd.ini

 

[ISAPI_Rewrite]

# 3600 = 1 hour

CacheClockRate 3600

RepeatLimit 32

RewriteRule ^(.*)/index\.html$ $1/index\.php

RewriteRule ^(.*)/index/(.*)/$ $1/index.php\?pg=$2

RewriteRule ^(.*)/blog/([0-9]+)\.html$ $1/blog.php\?id=$2

RewriteRule ^(.*)/blog/([0-9]+)\.html(&page=([0-9]+))?$ $1/blog\.php\?tid=$2&page=$4

RewriteRule ^(.*)/blog/(.*)/$ $1/blog\.php\?tid=$1

RewriteRule ^(.*)/category/([0-9]+)\.html$ $1/list.php\?act=cat_list&id=$2

RewriteRule ^(.*)/category/([0-9]+)/([0-9]+)\.html$ $1/list.php\?act=cat_list&id=$2&pg=$2

RewriteRule ^(.*)/archives/([0-9]+)/([0-9]+)/$ $1/list.php\?act=archives_list&date=$2/$3&pg=$4

RewriteRule ^(.*)/archive/([0-9]+)/([0-9]+)/$ $1/list.php\?act=archives_list&date=$2/$3

RewriteRule ^(.*)/category/(.*)/$ $1/list.php\?act=cat_list&keywords=$2

RewriteRule ^(.*)/page/(.*)/$ $1/page.php\?page=$2

RewriteRule ^(.*)/tag/(.*)/$ $1/tag.php\?tag=$2

RewriteRule ^(.*)/blog/(.*)/$ $1/blog.php\?keywords=$2

评论列表
©2015-2019 Powered by 蓝色航线旗下蓝色航线博客系统 v1.0