阅读

nginx wordpress伪静态

Nginx  2015-07-29 16:00

修改 nginx 配置文件,修改 location / {} 部分,增加 if 部分。

location    / {
    index       index.html index.htm index.php index.asp default.asp default.htm default.html default.aspx;
    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;
    }
}