WordPress设置固定链接出现404 Nginx解决

版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/shaynerain/article/details/82992976

wordpress设置固定链接后无法页面无法正常访问,出现404错误,经过查找资料先得知解决方案,方法如下,只针对nignx:

1、打开nginx配置文件

$ vim /usr/local/nginx/conf/nginx.conf

2、如果wordpress安装在网站根目录,在server中添加

location / {
                if (!-e $request_filename) {
                rewrite (.*) /index.php;
                }
        }

3、如果wordpress安装在网站二级目录,在server中添加,下面是安装在二级目录cn中,等效替换

location /cn/ {
                if (!-e $request_filename) {
                rewrite (.*) /cn/index.php;
                }
        }

4、最后重启nginx

/etc/init.d/nginx restart

猜你喜欢

转载自blog.csdn.net/shaynerain/article/details/82992976