Yesterday, I spent some time configuring permalinks in WordPress and setting up a custom 404 error page. The GoDaddy default 404 page is lame. I also wanted to add some JavaScript that Google provides to make some suggestions and ultimately provide a Google search of the site when the page you are looking for can not be found.
First, Google provided me with this code block to include in my custom 404.
<script type="text/javascript"> var GOOG_FIXURL_LANG = 'en'; var GOOG_FIXURL_SITE = 'http://www.flbelt.com/'; </script> <script type="text/javascript" src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
I was able to edit my theme 404.php file using WordPress Admin -> Appearance -> Editor, and selecting 404.php on the right. I added the JavaScript from Google and the php snippet below at the top to make the pages more search engine friendly (so they would return the proper 404 status code, rather than 200 OK when serving up the page)
<?php
header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");
get_header(); ?>
Now came the tricky part, when I would go to the GoDaddy control panel choose 404 Error Behavior, select custom and input /index.php?error=404 or /?error=404 as required by WordPress, GoDaddy would return an error and say that my custom page could not contain a question mark!
After searching around a bit, I decided to try to add the error page to .htaccess since GoDaddy would not support the option I was looking for. So I created a .htaccess in the root of my website with the following.
ErrorDocument 404 /?error=404
But in spite of the information in the .htaccess GoDaddy still seemed to redirect to the old error page. Now I was stumped and turned to Google.
There I found this blog entry showed the way to disable GoDaddy’s 404 handling and allow requests to pass to your .htaccess was to select the “Use home page” option (not documented on GoDaddy’s help portal btw).
Then I found this blog entry which pointed out the GoDaddy’s servers only refresh the .htaccess every so often. Their advice, just wait a little bit (was about 15 minutes for me) after you update/add an .htaccess before testing.
Finally it was working! After all that I was even able to turn on more descriptive permalinks in WordPress (which rely on .htaccess working properly also) and that is working now too!
You can use this link to see our custom 404 page. Took a little more time than I had wanted, but im happy with the end result!

#1 by Eric Felker on September 17, 2010 - 12:38 pm
Thank you for this, I was getting very frustrated!