lighttpd下关于typecho的3种伪静态规则,亲测可用
2014-02-10
最近一直在折腾vps的环境,突然发现其实小巧玲珑的lighttpd其实很好玩,相对于apache来说,资源消耗少了30%以上,对于配置不太好的VPS来说,真的是一大福音,那么现在我来献上一些实用的伪静态规则,首先是我在VPS上一直喜欢折腾的typecho伪静态规则,我一共找到3中,并且都可以用,大家只要把下面的规则粘贴到lighttpd.conf即可,注意是粘贴到lighttpd.conf文件哦,这也正是lighttpd伪静态与之不同的地方,PS:该文件一般位于/etc/lighttpd下,不排除有特殊情况。
1、首先是一段简短的,这段typecho伪静态规则我也在用。
url.rewrite-if-not-file = (
“^/(admin|usr)/(.*)” => “/$1/$2”,
“^/(.*)$” => “/index.php/$1”
)
2、然后是一段稍稍复杂的,但是效果我实测貌似一样。
url.rewrite-if-not-file = (
“^/(.*).htm$” => “/index.php/$1.htm”,
“^/archives/(.*)” => “/index.php/archives/$1”,
“^/category/(.*)” => “/index.php/category/$1”,
“^/([0-9]+)/([0-9]+)/$” => “/index.php/$1/$2/”,
“^/tag/(.*)/$” => “/index.php/tag/$1”,
“^/search/(.*)/$” => “/index.php/search/$1”,
“^/(.*)page/(.*)” => “/index.php/$1page/$2”,
“^/(feed.*)” => “/index.php/$1”,
“^/action/(.*)” => “/index.php/action/$1”,
“^/(.*)comment” => “/index.php/$1/comment
)
3、还有一个就是32mb博主放出自用的。
url.rewrite = ( "^/(admin|usr)/(.*)" => "/$1/$2", "^/(.*).html$" => "/index.php/$1.html", "^/archives/(.*)" => "/index.php/archives/$1", "^/category/(.*)" => "/index.php/category/$1", "^/([0-9]+)/([0-9]+)/$" => "/index.php/$1/$2/", "^/tag/(.*)/$" => "/index.php/tag/$1", "^/search/(.*)/$" => "/index.php/search/$1", "^/(.*)page/(.*)" => "/index.php/$1page/$2", "^/(feed.*)" => "/index.php/$1", "^/action/(.*)" => "/index.php/action/$1", "^/(.*)comment" => "/index.php/$1/comment" )
以上三种规则我都亲自试过可以使用,大家用得上的可以试试~过几天将会放出lighttpd下更多的伪静态规则,都是相当实用的啊,不要让lighttpd的伪静态成为了发展的理由。