Forums

404 returns blank page (7 posts)

  1. adamoliver
    Member
    Posted 3 years ago #

    I'm working on a blog at http://blog.mbluk.com and am having trouble getting a 404 page to appear. I have pretty permalinks set up which work fine but when you go to a page that does not exist a blank page appears which returns 200.

    Turning off the pretty permalinks fixes the problem but it would be nice to have it working with the clean URL.

    I have a few plugins that I have used but turning them off doesn't fix the problem. I have also created a 404 file for the template.

    Here's the .htaccess file that WordPress has generated:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
  2. Samuel B
    moderator
    Posted 3 years ago #

    you have a 404.php in your theme?

  3. adamoliver
    Member
    Posted 3 years ago #

    yeah I created a 404.php page

  4. AndyiBM
    Member
    Posted 2 years ago #

    I also have this issue, but I also have another site where, using .htaccess:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    ErrorDocument 404 /index.php?error=404
    </IfModule>
    # END WordPress

    and Pretty Permalinks set-up, I get a page of source code appear instead of my 404.php, which is present in my themes folder.

    Is there a straightforward solution to this?

  5. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try removing the ErrorDocument 404 /index.php?error=404 line and see how WP handles it. If there's a problem, it might worth quickly switching to the default theme to test whether this is theme-related.

  6. AndyiBM
    Member
    Posted 2 years ago #

    I removed the ErrorDocument line, and it made no difference on either site. I swapped back the Default theme, and got a different page of Source Code displayed for the one, and an unstyled HTML page for the other.

    Have a dreadful feeling that there's something inherently wrong with all my code...

  7. AndyiBM
    Member
    Posted 2 years ago #

    I've added it to a fresh installation, and now it's working.

    Frustrating that I don't know what I did wrong, but relieved it now works.

Topic Closed

This topic has been closed to new replies.

About this Topic