Forums

[resolved] 404.php --- Mysterious Sub-Sub-Subfolder Error. (6 posts)

  1. sallymcdonald
    Member
    Posted 3 years ago #

    Hey everyone, I'm having a very strange problem at the moment with my 404 page. When I visit a fake subfolder such as:
    http://www.example.com/wordpress/abc/
    It works perfectly.

    When I visit a fake sub-subfolder such as:
    http://www.example.com/wordpress/abc/abc/
    It still works perfectly!

    But if I visit a fake sub-sub-subfolder, (Or anything higher than a sub-sub-sub,) Such as:
    http://www.example.com/abc/abc/abc/
    It only works halfway. My '404 Error' image shows up, but the accompanying text, 'Sorry, that page wasn't found.', doesn't show up at all, as if the text was never there.

    Everything else works perfectly, the header, the sidebar, the footer ... Everything except the text.

    I know this isn't normal behaviour, so how do I go about fixing it? Here is my 404.php's code:

    <?php get_header(); ?>
    
    <div id="container">
    
    <div class="imagetitle">
    <img src="http://www.example.com/wordpress/404error.gif" alt="404 Error" title="404 Error" /></div>
    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    
    <?php endwhile; ?>
    <?php else : ?>
    <div class="post">
    <h3>Sorry, that page wasn't found.</h3>
    </div>
    <?php endif; ?>
    </div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
    
    </div>
    </body>
    </html>
  2. sallymcdonald
    Member
    Posted 3 years ago #

    Er, anyone have any insight ...?

  3. sallymcdonald
    Member
    Posted 3 years ago #

    I've discovered something strange ... When I switch my permalink structure from /%postname%/ to /%category%/%postname%/, my 404 page works perfectly every time.

    It also works when I use simply /%post_id%/ ... Just never when I use /%postname%/ on its own. Very strange.

    Here's to hoping someone responds.

  4. sallymcdonald
    Member
    Posted 3 years ago #

    I'm just going to bump this. I've been working for hours, trying to figure this out on my own ... But I'm not having much luck! :(

  5. sallymcdonald
    Member
    Posted 3 years ago #

    If anyone's willing to help, I'd be about ready to send them a cash reward by now! :P

  6. sallymcdonald
    Member
    Posted 3 years ago #

    Never mind, I figured it out. [No thanks to you guys. :/ ]

    I modified the 404.php page as so, and everything works perfectly now.

    <?php get_header(); ?>
    
    <div id="container">
    
    <div class="imagetitle">
    <img src="http://www.example.com/wordpress/404error.gif" alt="404 Error" title="404 Error" /></div>
    
    <div class="post">
    <h3>Sorry, that page wasn't found.</h3>
    </div>
    </div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
    
    </div>
    </body>
    </html>

Topic Closed

This topic has been closed to new replies.

About this Topic