• 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: https://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: https://www.hijackedyork.com/wp-content/themes/hijacked/404.php

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter jamiedustuk

    (@jamiedustuk)

    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

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

    Thread Starter jamiedustuk

    (@jamiedustuk)

    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(); ?>
    Thread Starter jamiedustuk

    (@jamiedustuk)

    Thread Starter jamiedustuk

    (@jamiedustuk)

    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

    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.

    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

    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.

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

    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.

    Thread Starter jamiedustuk

    (@jamiedustuk)

    Thanks, the plugin works great!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘404 not working properly’ is closed to new replies.