How to make WordPress display a 404 page with GoDaddy hosting
ElementZero | January 30, 2009Whenever you design a website, it is a good idea to even take the little things into consideration in order to make the user experience the best. That being said, I noticed the other day that anytime someone hit a 404 page to my site they received the GoDaddy error message for a 404, which is pretty generic. I looked inside my templates for WordPress and say that there is a 404.php template, but it was never called for some reason. My first guess was that the GoDaddy 404 superseded anything WordPress was trying to do; annoying at best.
I tried to change the options in the GoDaddy configuration to get it to not override the WordPress 404 page, but to no avail. Finally I opened the WordPress logic up and went through it and pulled out the code to make a static page I could give GoDaddy that would force it to use the WordPress 404 template, then set GoDaddy to hit that page on 404 errors. Problem solved! ![]()
If you would like to duplicate my steps, here is what you need to do.
Step 1: Make the file to force GoDaddy to use the WordPress 404 page
First, open up a text editor (notepad, nano, whatever) and put the following in the file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <?php // Make the page return a 404 status for SEO purposes header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); // Now force the normal 404 error WordPress logic define('WP_USE_THEMES', true); if ( !isset($wp_did_header) ) { $wp_did_header = true; require_once( dirname(__FILE__) . '/wp-load.php' ); wp(); if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) { do_action('template_redirect'); if ($template = get_404_template()) { include($template); return; } } } ?> |
and save the file as 404.php .
Step 2: Upload the custom 404 page to your site
Next, FTP or use the GoDaddy File Manager to put this file in the root of your GoDaddy installation. If you use multiple domains, you can put them in the root of those individual domain folders.
Step 3: Change the GoDaddy 404 Error Behavior
Now go into the GoDaddy Hosting Control Panel, and go under settings. Open the “404 Error Behavior” and then set it to “Use a custom error page”, and then put 404.php in the text box.
Now all you have to do is wait like 5-30 minutes (depending on how busy GoDaddy’s servers are) for GoDaddy to update the 404 behavior for your site, and you should be set. Go ahead and type in some invalid url (i.e. – http://www.omegaprojex.com/kbegjbwgjb ) and you should see your 404 page come up all nice and templated.
Step 4 (optional): Customize your 404 template page
If you want to customize the error message giving by your 404 template (this is normally done by your template) you can just go into your WordPress admin site, go to appearance–>editor and change your 404.php template to say whatever you want. Be careful though – you need to know a little html to do this part; you may want to make a backup of the text that’s in there and experiment a bit if you are unsure how to change the text.
Troubleshooting
Note that although this will force WordPress to load the 404 page designated for your template, in some templates the 404 page may not be specified, so if this doesn’t work right for you, you might want to go check in appearance–>editor inside the WordPress Admin Console and make sure you have a 404.php page. If you don’t there are hundreds of web sites out there that tell you how to make one – so many that I don’t feel it’s necessary to repeat it here.
In any case, this is an extremely dirty hack; after all it doesn’t even really using the confines of the WordPress application to do this. It does work however, and I don’t really see much in the way of an alternative unless GoDaddy changes how the 404 behavior logic works. Given GoDaddy’s “support” record on stuff like this, I doubt that will ever happen.







Thanks a ton!! Worked like a charm. Perfect step by step write up.
i have several websites hosted at Godaddy and i am pretty much satisfied with this domain name registrar. it is also very easy to get coupon codes for Godaddy.