[Nginx] WordPress在Nginx环境下配置伪静态

Apache环境下使用.htaccess实现Wordpress的通用伪静态效果

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

Nginx环境下需要做如下重写,适用于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;
}
}

———————
作者:CG李大仁
来源:CSDN