宝塔面板:解决Nginx下WordPress后台404的问题

原梓番
原梓番
管理员
827
文章
0
粉丝
建站 技术流评论14,7421阅读模式

wordpress官方的伪静态是通过.htaccess实现的,但nginx并不支持.htaccess,所以要在宝塔后台设置伪静态

 文章源自原紫番博客-https://www.yuanzifan.com/7695.html

登录宝塔后台,点击左侧“网站”,选择你要调整的网站,点击“设置”,弹窗后在弹窗上点击‘配置文件’(如下图),在配置文件中添加下图红框中的代码。
代码如下:文章源自原紫番博客-https://www.yuanzifan.com/7695.html

[code]文章源自原紫番博客-https://www.yuanzifan.com/7695.html

location / {
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;
}
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;文章源自原紫番博客-https://www.yuanzifan.com/7695.html

[/code]文章源自原紫番博客-https://www.yuanzifan.com/7695.html

添加这段代码后点保存,wordperss的静态页,后台就都可以正常显示出来了。文章源自原紫番博客-https://www.yuanzifan.com/7695.html 文章源自原紫番博客-https://www.yuanzifan.com/7695.html

站长微信
扫码添加(注明来意)
weinxin
Yuanzifan99
微信号已复制
原梓番博客公众号
博客内容精选
weinxin
原梓番博客
公众号已复制
 

发表评论

匿名网友
确定

拖动滑块以完成验证