• I’m working on a blog at https://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
Viewing 6 replies - 1 through 6 (of 6 total)
  • you have a 404.php in your theme?

    Thread Starter adamoliver

    (@adamoliver)

    yeah I created a 404.php page

    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?

    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.

    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…

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘404 returns blank page’ is closed to new replies.