Nginx下让WordPress支持固定链接的伪静态规则
Nginx下让WordPress支持固定链接的伪静态规则
要让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;
}
}
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;
}
}
然后,重启lnmp即可,命令如下:
#~:nginx restart