dou29106 2014-06-23 12:57
浏览 113
已采纳

404页面不会显示/没有.htaccess Wordpress

I want to show my 404 error page when ever someone gets on a non working / non created page. After a long time of searching on the web I couldnt find any solution so I post one myself. I dont have any .htaccess file either i created it filled it in but in my FTP it kept saying nothing was safed in there and it didnt show any bytes so thats something im also worried of.

So how can i get my .htaccess file to work and show my 404 Error page template? I followed all the steps to make a 404.php file but i dont mind it to be redirected to the same template I made for it but then as a page any of those solutions is fine.

  • 写回答

1条回答 默认 最新

  • drkjzk3359 2014-06-23 13:27
    关注

    You've got some rewrite rules in your .htaccess file that are preventing a 404 error from every truly happening...

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /index.php [L] 
    

    That basically states that if the requested resource is neither a file nor a directory (basically a 404 error), redirect to /index.php

    Try this in your .htaccess:

    # BEGIN WordPress 
    <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase / 
    
    # delete the line below to have /index.php/anything trigger a 404
    RewriteRule ^index\.php$ - [L] 
    
    </IfModule> 
    # END WordPress
    
    #404 redirect
    ErrorDocument 404 /httpdocs/wp-content/themes/avian/404.php 
    

    Note This may make Wordpress quite unhappy however, I'm not sure how it uses internal routing, it may rely on breaking 404s to determine which pages to load by using fake (RESTful) URLs - reinstating 404 errors make cause Wordpress to stop working properly ... I am, however, no expert on it having barely ever touched it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题