≡ Menu

I’ve been moving websites a lot lately, so I’ve been finding dead links like crazy.  I’ve been moving all of my websites from GoDaddy Hosting to HostGator hosting (which I’ll write about soon).

Running the Thesis WordPress theme on HostGator resulted in having 2 different 404 pages.  One is the default Thesis 404 page, which is okay, but the other one is an obnoxious HostGator 404 page that is basically just a HostGator advertisement.  I love HostGator, but that’s a bunch of crap.

Changing the HostGator 404 Page

This part is pretty easy if you’re familiar with the .htaccess file.

In theory, it should work to add the following to your .htaccess file:

ErrorDocument 404 /new404.html

“new404.html” would be the address of your 404 page.  I haven’t been able to test this, though.  Now that I want to break my pages, I’m having a hard time doing it…  Let me know if that code doesn’t work, please!

Changing  the default Thesis 404 Page

I don’t really mind the default 404 page that Thesis uses, but it could be more helpful.  I made a couple quick changes to mine to help explain to users how to find the content they were looking for, or to get back to the Home page.  Check out the 404 page for my Washers site.

All you need to do to make some changes is to add a few lines of code to your Thesis custom_functions.php file.

Here’s what I used:

/* Custom 404 Hooks */
function custom_thesis_404_title() {
?>
The Page you requested is somewhere here.
<?php
}
remove_action(‘thesis_hook_404_title’, ‘thesis_404_title’);
add_action(‘thesis_hook_404_title’, ‘custom_thesis_404_title’);

function custom_thesis_404_content() {
?>
<h2>Lose Your Way?  Don’t Worry!</h2>
<p>Let’s get you back on track!<br /><br />
If you know what you’re looking for, please use the search box on the right.<br /><br />
Otherwise, go ahead and start over at the <a href=”http://www.washergameplayers.com”>Home</a> page.<br /><br />
Thanks for visitng <a href=”http://www.washergameplayers.com”>Washer Game Players!</a></p>
<?php
}
remove_action(‘thesis_hook_404_content’, ‘thesis_404_content’);
add_action(‘thesis_hook_404_content’, ‘custom_thesis_404_content’);

Basically, this function uses hooks to remove the default 404 page, then replaces it with your new content.

I had to add in my own H2 tags for a headline, as I have the headline tags removed from my Thesis Theme.

I found the 404 info on a couple of websites, then altered it work for my site.  For more info, check out:
http://www.shoutmeloud.com/customizing-thesis-wordpress-theme-404-error-pages.html
http://www.sugarrae.com/thesis-tutorial-custom-404/

{ 0 comments }

Leave a Comment