nginx配置wordpress伪静态
nginx配置wordpress伪静态与apache配置wordpress伪静态有很大区别。
1.WORDPRESS配置
2.nginx.conf配置
在SERVER段最后增加下列配置
#ignored: “-” thing used or unknown variable in regex/rew
rewrite ^/([_0-9a-zA-Z-]+/)?wp-admin$ /$1wp-admin/ permanent;
if (-f $request_filename){
set $rule_2 1;
}
if (-d $request_filename){
set $rule_2 1;
}
if ($rule_2 = "1"){
#ignored: “-” thing used or unknown variable in regex/rew
}
rewrite ^/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) /$2 last;
rewrite ^/([_0-9a-zA-Z-]+/)?(.*.php)$ /$2 last;
rewrite /. /index.php last;
}
include vhost/*.conf;
3.重启加载NGINX
nginx -s reload