WordPress lighttpd的rewrite(伪静态)规则

作者:zqcheng    发布于8年前 (2010-11-28)    阅读:  221  次

几个wordpress博客搬家到vps上来了,需要在kloxo里添加lighttpd地址重写规则,这里记录一下规则:

url.rewrite = (
"^/(wp-.+).*/?" => "$0",
"^/(sitemap.xml)" => "$0",
"^/(xmlrpc.php)" => "$0",
"^/(.+)/?$" => "/index.php/$1"
)

在wordpress目录下的.htaccess文件内容如下:
# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

如果wordpress在子目录下安装,如domain.com/blog ,规则如下:

url.rewrite = (
"^/blog/(wp-.+).*/?" => "/$0",
"^/blog/(sitemap.xml)" => "/blog$0",
"^/blog/(xmlrpc.php)" => "/blog$0",
"^/blog/(.+)/?$" => "/blog/index.php/$1"
)

在wordpress目录下的.htaccess文件内容如下:
# BEGIN WordPress

RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

# END WordPress