假如主目录也需要伪静态 二级目录WordPress也需要伪静态该怎么添加?
请在主目录下面直接添加你一级目录的伪静态规则
然后添加WordPress伪静态
普通伪静态下,在conf下面写下面的代码
location /
{
try_files $uri uri/ /index.php?uri//index.php?args;
}
rewrite /wp-admin$ scheme://scheme://host$uri/ permanent;
而二级目录伪静态,则需要新加入以下代码:
如果是在宝塔中,只需要网站列表-伪静态-在默认的wordpress代码下加入下面的代码,即可实现二级目录伪静态
location /二级目录名称/ {
index index.html 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;
}
}