wordpress更改“固定鏈接”模式后,頁面出現404原因及解決方法


Nginx 解決方案:

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

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;
}

 

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM