[nginx]Typecho伪静态规则

安装在根目录下:

 1 location / {
 2     index index.html index.php;
 3     if (-f $request_filename/index.html){
 4         rewrite (.*) $1/index.html break;
 5     }
 6     if (-f $request_filename/index.php){
 7         rewrite (.*) $1/index.php;
 8     }
 9     if (!-f $request_filename){
10         rewrite (.*) /index.php;
11     }
12 }

安装在子目录下:

 1 location /subfolder/ {
 2     if (-f $request_filename/index.html){
 3         rewrite (.*) $1/index.html break;
 4     }
 5     if (-f $request_filename/index.php){
 6         rewrite (.*) $1/index.php last;
 7     }
 8     if (!-f $request_filename){
 9         rewrite (.*) /subfolder/index.php last;
10     }
11 }