wordpress安装在二级目录下的伪静态设置
最近做了一个站,根目录是别的cms,二级的话是wordpress,那么就需要伪静态了,找了三种办法,分享给大家!
第一种:
这二级目录下安装Wordpress的伪静态三个方法就在这上面啦!
第一种:
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;
}
}
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;
}
}
location /目录名/ {保存固定链接后,弄好伪静态后要注意会不会404!!
try_files $uri $uri/ /目录名/index.php?q=$uri&$args;
}
这二级目录下安装Wordpress的伪静态三个方法就在这上面啦!