wordpress在lnmp环境下静态化

wordpress的静态化网上有以下几种方式

第一种最普遍的

location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}

第二种

http://www.lutuzhi.com/opensource/306.html

if (!-e $request_filename) {

#下面四行斜体字实现链接rewrite,http://www.lutuzhi.com中的所有页面实现了静态化 

rewrite ^/(index|atom|rsd)\.xml$ http://www.lutuzhi.com last;

rewrite ^([_0-9a-zA-Z-]+)?(/wp-.*) $2 last;

rewrite ^([_0-9a-zA-Z-]+)?(/.*\.php)$ $2 last;

rewrite ^ /index.php last;

}

第三种

http://www.tetx.com/program/htm/tetx/blog/view/blog_id/1291521408/index.htm

location / {
# This is cool because no php is touched for static content
try_files $uri $uri/ /index.php;
}

wordpress 后台设置为:

Settings — Permalinks — Common settings — Custom Structure 输入

/%year%/%monthnum%/%day%/%postname%.html

 

设置—固定连接—自定义结构

参考:http://wiki.nginx.org/Wordpress

This entry was posted in linux. Bookmark the permalink.

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>