Warning: file_put_contents(pb_book.txt): failed to open stream: No space left on device in /www/wwwroot/wpcun.com/wp-content/themes/justnews/single.php on line 31

Warning: filemtime(): stat failed for pb_book.txt in /www/wwwroot/wpcun.com/wp-content/themes/justnews/single.php on line 36
wordpress教程:修复军哥lnmp一键安装wordpress伪静态规则错误 | 王牌文学网

wordpress教程:修复军哥lnmp一键安装wordpress伪静态规则错误

点击阅读全文

如果你是用的军哥的LNMP一键安装包,首先跟我来试一试,你是不是也有这个问题,访问你的域名/wp-admin,然后在左侧菜单中随便点击一个,比如文章,这是你会发现,大大的一个404 Not Found.
是不是出现上图那种情况?解决的方法很简单,只需在WordPress的伪静态配置文件中添加一条判断,判断如果网址到达页面为目录,且该网址最后的字符不为斜杠“/”,则301跳转到在该网址最后添加斜杠后的网址。代码为:

if (-d $request_filename){ rewrite ^/(.*)([^/])$ /$1$2/ permanent;}

最后的wordpress.conf应该为:

location / { if (-d $request_filename){ rewrite ^/(.*)([^/])$ /$1$2/ 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; }}

最后送上我的wordpress.conf文件吧,下载地址在下面,演示地址是参考的原文链接哦。。。

                       
上一篇 2020年5月24日 18:34
下一篇 2020年5月24日 19:04

Warning: error_log(/www/wwwroot/wpcun.com/wp-content/plugins/spider-analyser/#log/log-2805.txt): failed to open stream: No space left on device in /www/wwwroot/wpcun.com/wp-content/plugins/spider-analyser/spider.class.php on line 2966