wordpress更改“固定链接”模式后,页面出现404错误原因及解决方法

  • A+
所属分类:网站建设

wordpress更改“固定链接”模式后,页面出现404原因及解决方法

Nginx 解决方案:

在 /etc/nginx/config.d/mysit.conf文件的 loction \ {} 中添加

wordpress更改“固定链接”模式后,页面出现404错误原因及解决方法
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更改“固定链接”模式后,页面出现404错误原因及解决方法

 

Apache解决方案:

etc/httpd/conf/httpd.config 文件

原因一:Apache中的rewrite模块没有开启,去除这一行前面的#号就可以了

LoadModule rewrite_module modules/mod_rewrite.so

原因二:AllowOverride Not Enabled;服务器可能没打开AllowOverride。如果httpd.config的AllowOverride设置的是None,那.htaccess将被忽略。找到以下2处位置并修改:

<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/html>
# … other directives…
AllowOverride All
</Directory>

修改完成后,要重启Apache才能生效。

service httpd restart
  • 客服微信
  • 微信扫一扫添加微信
  • weinxin
  • 沈阳SEO培训
  • 报名学习SEO优化课程
  • weinxin
沈阳SEO

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: