WordPress 404 page Fix for Streamline and Fasthosts

This is something that caused me a massive headache for a site i was building for a client using Fasthosts Servers. I have had experience using Streamline.net and Fasthosts for a number of projects, and i can safely say their level of service is poor (thats putting it lightly) and the performance of the servers they use are terrible, to such an extent, I advise all my clients to avoid them at all costs. But this is not a post about my dislike for Streamline.net and Fasthosts, you may have had no trouble with them at all and you’re perfectly happy with the service, and thats fine! No, this post is for WordPress developers and designers, who experience their 404 (page not found) page breaking or failing to load properly. This drove me nutts, but I’ve found the solution and I want to share it with you.

The Problem

So what was the problem? well every time I tested the 404 page with my WordPress site on a Streamline.net and Fasthosts server, the page would only load part of its code, breaking a semantic line in the header.php. This bug seams to be unique to Streamline.net and Fasthosts servers, what ever seams to be happening the 404 page fails to load completely, only showing part of the main content, the sidebar and footer.

The Solution

Create a new page in your WordPress admin, call it “page-not-found-fix”, add your 404 message ‘sorry the page you’re looking for is not here!’. Then open your 404.php file and replace the entire code with the following:

header( 'Location: http://www.yourdomain.com/page-not-found-fix' ) ;

Save it and test it, your 404 page will now work with the troublesome servers. its an nifty little fix for a massively irritating problem, enjoy. the sourse of this code was fond here: WordPress Forums