1.
location / {
rewrite ^/目录名/wp-admin$ /目录名/wp-admin/ permanent;
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;
}
}
2.
location /目录名/{
rewrite ^/wp-admin$ /wp-admin/ permanent;
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;
}
}
3.
location /目录名/ {
try_files $uri $uri/ /目录名/index.php?q=$uri&$args;
}
保存固定链接后,弄好伪静态后要注意会不会404!!