为节省vps内存占用,提高浏览速度,终于把emlog搬到Lighttp上去了,酝酿了好几天,因为Lighttpd的教程少,有些规则都需要自己搞定,对不懂代码的自己倒是费尽了周折,还好,网站可以正常访问了,也顺便把从网上找的Lighttpd伪静态规则和自己添加的整理了一下,emlog新版Lighttpd伪静态规则网上很少,搜集了些添加了些应用自己博客使用的规则,算是最新Emlog伪静态规则完整版了。
$HTTP["host"] =~ "^zairun.com$" {
url.redirect = (
"^/(.*)" => "http://www.zairun.com/$1",
)
}
url.rewrite-once = (
"^(.*)/post-([0-9]+).html/comment-page-([0-9]+)$"=>"$1/index.php?post=$2&comment-page=$3",
"^(.*)/favicon.ico$" => "$1/favicon.ico",
"^(.*)/sitemap.xml$" => "$1/sitemap.xml",
"^(.*)/robots.txt$" => "/$1/robots.txt",
"^(.*)/wlwmanifest.xml$" => "$1/wlwmanifest.xml",
"^(.*)/guanyuwo.html$"=>"$1/index.php?guanyuwo=$2",
"^(.*)/liuyan.html$"=>"$1/index.php?liuyan=$2",
"^(.*)/author/([0-9]+)/page/([0-9]+)$"=>"$1/index.php?author=$2&page=$3",
"^(.*)/record/([0-9]+)/page/([0-9]+)$"=>"$1/index.php?record=$2&page=$3",
"^(.*)/sort/([zatan|xingqu|youwan|yangsheng|diannao|vps|zhuanzai|xiazai]+)/page/([0-9]+)$"=>"$1/index.php?sort=$2&page=$3",
"^(.*)/tag/(.+)/page/([0-9]+)$"=>"$1/index.php?tag=$2&page=$3",
"^(.*)/post-([0-9]+).html$"=>"$1/index.php?post=$2",
"^(.*)/author/([0-9]+)$"=>"$1/index.php?author=$2",
"^(.*)/record/([0-9]+)$"=>"$1/index.php?record=$2",
"^(.*)/sort/([zatan|xingqu|youwan|yangsheng|diannao|vps|zhuanzai|xiazai]+)$"=>"$1/index.php?sort=$2",
"^(.*)/tag/(.+)$"=>"$1/index.php?tag=$2",
"^(.*)/page/([0-9]+)$"=>"$1/index.php?page=$2"
)
下面这段301重定向,网上很多Lighttp 301重定向都是不能使用的。这个很好用添加后可以使用站长工具HTTP状态检测,返回状态码301。
$HTTP["host"] =~ "^zairun.com$" { url.redirect = ( "^/(.*)" => "http://www.zairun.com/$1", ) }