Featured image of post wordpress安装在非根目录的错误

wordpress安装在非根目录的错误

wordpress安装在非根目录需要修改伪静态规则

问题

我把wordpress的安装目录修改成非根目录,然后发现只能打开主页和后台,文章相关的页面无法打开

解决办法

修改伪静态规则,在/index.php?$args;前添加子目录路径

1
2
3
4
5
6
7
location / {
  try_files $uri $uri/ /子目录路径/index.php?$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~* ^/wp-content/uploads/.*\.php$ {
  deny all;
}
使用 Hugo 构建
主题 StackJimmy 设计