WordPress.org

Ready to get started?Download WordPress

Forums

404 not working properly (12 posts)

  1. jamiedustuk
    Member
    Posted 5 years ago #

    im having a very strange 404 bug, when i link to a page that doesnt exist using the default 404.php, it seems to only output the second half of the pages code, it misses out the entire header and some of the main body, when i alter the contents of 404.php it changes where it cuts in:

    take a look here: http://www.hijackedyork.com now try and go to any gobbledygook page you will see what i mean.

    i have tried using a wordpress theme 404 i.e. with the call for header etc, i have tried copying outputted html from my blog i.e. not having wordpress code in but static html, i have also tried just having a plain page with some text, in that case it didnt show anything...

    as you can see, my 404 should look like this: http://www.hijackedyork.com/wp-content/themes/hijacked/404.php

    any idea what is going on, why im losing half my code?

  2. jamiedustuk
    Member
    Posted 5 years ago #

    anyone? seems like a really strange bug, i would rather just have a standard 404 error than a customisable one if its going to give me this

  3. esmi
    Forum Moderator
    Posted 5 years ago #

    Do you currently have a 404.php file in your theme?

  4. jamiedustuk
    Member
    Posted 5 years ago #

    yes it looks like this:

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    
    get_header();
    ?>
    
    	<div id="content" class="narrowcolumn">
    
    		<h2 class="center">Error 404 - Not Found</h2>
    
    	</div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
  5. jamiedustuk
    Member
    Posted 5 years ago #

  6. jamiedustuk
    Member
    Posted 5 years ago #

    there seems to be no logic to where it decides to start outputting code from but its always from the same place, unless things are added or removed from the 404.php

  7. esmi
    Forum Moderator
    Posted 5 years ago #

    Nothing obviously wrong with the 404 file. Maybe there's a problem within the individual template files? Or your permalinks? Try resetting them to the default setting.

  8. codinggeek
    Member
    Posted 5 years ago #

    If you are using only pages, probably your 404.php will not work and your page.php doesn't have code for "no posts". So copy the else part of having posts section and paste it in your page.php

  9. Bramernic
    Member
    Posted 4 years ago #

    Sorry to bounce this topic but I am having exactly the same problem. It even goes wrong on the default theme. It looks to me like a bug in the core code of wordpress. Basically, if you enter a url that doesn't exist you get an html page without the first bit. It literally chops out everything until some random point in the page. Because of this you actually get raw html displayed on the screen. Viewing the source displays the same thing because the page had no header etc.

    Using my limited knowledge of how this all works it seems like the output buffer is being flushed part way through outputting the page, leaving only the second block onwards to be sent to the browser.

    I really would appreciate any help in fixing this.

  10. jamie33lee
    Member
    Posted 4 years ago #

    Having the same problem, to no avail. No one seems to be able to reply to my thread!

  11. Bramernic
    Member
    Posted 4 years ago #

    I've written a plugin to get round this problem. It traps 404 errors and changes them to 301 while redirecting to a page specified in settings. It's called No 404 Errors.

  12. jamiedustuk
    Member
    Posted 4 years ago #

    Thanks, the plugin works great!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags