Typecho Nginx 伪静态规则

2015-12-18

适用于nginx使用。军哥lnmp内置:

    if (!-e $request_filename) {
        rewrite ^(.*)$ /index.php$1 last;
    }

apache规则:

 
RewriteEngine On 
RewriteBase /
RewriteCond %{SERVER_PORT} !^443$ 
RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php/$1 [L] 

旧版:

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