WordPress多站点Nginx伪静态规则
详细请参考下面链结
https://developer.wordpress.org/advanced-administration/server/web-server/nginx/
# wordpress固定链接设置
try_files $uri $uri/ /index.php?$args;
# 管理面板添加斜杠
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# 传递上传文件给 wp-includes/ms-files.php
rewrite /files/$ /index.php last;
# 重写多站点 '.../wp-.*' and '.../*.php'.
if (!-e $request_filename) {
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
规则2
#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;