Support » Fixing WordPress » Major 404 display error – clashes with Permalinks – any advice?

  • A couple of other forum posts have identified this same error (see this post and this one).

    In short: the 404.php error function is failing, displaying a chunk of source code (apparently from the sidebar) instead of the 404 message, as per:

    http://www.blogobeer.com/gubbins

    This problem is by no means limited to this WP installation – it’s currently affecting every single WP site I’m hosting with Fasthosts (although according to the first linked post, above, the same problem exists on sites hosted with streamline.net as well) with various WP versions from 2.1 through to 2.6 all displaying the same error.

    I’ve spoken to Fasthosts support and they’re looking into the issue. We’ve narrowed it down to a clash between some aspect of their server setup (possibly their own management of custom error pages) and the WP .htaccess line:

    RewriteRule . /index.php [L]

    Removing this line from .htaccess and then stripping out any WP-specific functions from the 404.php file (i.e. <?php get_header(); ?>, <?php get_sidebar(); ?>, <?php get_footer(); ?>) results in the remaining text-based content displaying when a 404 is called. But that same RewriteRule also controls WP’s permalinks, so removing it prevents them from working across the site – not a workable solution.

    This seems to be a fairly recent development – the 404 pages all used to work – which suggests a recent change in server management routines has caused the clash. The Fasthosts support guy I’ve been talking to has been extremely helpful and has also managed to get a couple of third-line engineers involved, but in the meantime, he’s asked me to post the following:

    When navigating directly to the error page itself you get this error:

    Fatal error: Call to undefined function get_header() in /home/fhlinux152/b/blogobeer.com/user/htdocs/wp-content/themes/BoB/404.php on line 1

    I think that when the call is made to load the error page by going to a non existent page it is truncating due to the above fatal error. I think a combination of this and possible rewrite rules may be causing the issue.

    If anyone here has a better understanding than either of us as to how the .htaccess RewriteRule interfaces with Permanlinks, and how that might be affected by likely linux server settings, please do leave a reply. And if I should be raising this as a bug ticket instead, then please let me know and I’ll get right onto it.

    Cheers!

Viewing 6 replies - 1 through 6 (of 6 total)
  • I’m getting a similar error that seems to be a clash between the WordPress Permalinks settings in the .htaccess file, the WordPress 404 error handling and maybe the 404 settings on my host server.

    This is the error message I’m getting:

    Catchable fatal error: Object of class WP_Error could not be converted to string in /web2/user8211/website/wp-content/themes/SailingCalendars/category.php on line 6

    Seems that for some reason the WordPress Error handling isn’t redirecting to my 404.php template in my theme. I’ve even added this to my .htacess file:

    ErrorDocument 404 /index.php?error=404

    But still no joy! Anyone else had this problem and found a solution?

    Dan

    Hi,

    As you have changed the permalink structure, add this code in htaccess and have a check:

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

    Thanks,

    Shane G.

    Hi Shane,

    Thanks for the code – I’ve tried adding the extra line to my htaccess file but I’m still getting the smae error. It’s like WordPress is bypassing the 404.php template and using my category.php template instead.
    Here’s the actual error I’m getting:

    Catchable fatal error: Object of class WP_Error could not be converted to string in /web2/user8211/website/wp-content/themes/SailingCalendars/category.php on line 6

    I tried removing the category template, and then it uses the default index.php to render the page. It’s just not picking up my 404 template.

    Very strange – never had this issue before – but this client is on a different hosting server.

    Many thnaks for your help

    Dan

    Hi Dan –

    There’s a possible solution down at the bottom of this thread: http://wordpress.org/support/topic/210653?replies=23

    If you’re having the same issues that I’ve been having for a while (caused by Fasthosts’ own custom error pages clashing with WP’s 404 page and fasthosts showing no interest whatsover in working on a fix) then that should sort you out.

    DT

    Has anyone managed to find a solution to this 404 problem with Fasthosts yet? If so, please post! Thanks.

    I’m having the same problem with a client site and haven’t found any solution that respects how a 404 should be handled. The “possible solution” in the thread posted by Darren doesn’t return the correct status.

    My best advice is get the hell off Fasthosts. They are an outdated dinosaur and don’t give a crap about customer service. I thoroughly recommend EzPz Hosting as an alternative. Although they don’t have phone support, every thing I’ve ever raised has been dealt with from their online support hub in less than 30 minutes.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Major 404 display error – clashes with Permalinks – any advice?’ is closed to new replies.