WordPress更改“固定链接”后 ,页面出现404的解决方法

一、Web服务器对应的是Nginx

解决方案:修改linux服务器下Nginx的配置文件,目录为:/usr/local/nginx/conf/nginx.conf,

也可以直接使用命令nginx -t:

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

修改配置文件:在location下增加以下代码

 1 if (-f $request_filename/index.html){
 2 
 3     rewrite (.*) $1/index.html break;
 4 }
 5  
 6 if (-f $request_filename/index.php){
 7     rewrite (.*) $1/index.php;
 8 }
 9  
10 if (!-f $request_filename){
11     rewrite (.*) /index.php;
12 }

 

重启Nginx服务:service nginx restart

二、Web服务器对应的是Apache:原文链接:https://www.jiloc.com/41536.html

关于Nginx:(来源百度)

Nginx是一款轻量级Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度、京东新浪网易腾讯淘宝等。

 

posted @ 2018-02-27 16:26  谢小鑫的博客  阅读(434)  评论(0编辑  收藏  举报