Create A 404 Error Redirect For WordPress

404error.jpgThere are several different solutions for a 404 error page or redirect with a WordPress site or blog. A 404 error is when a URL on a domain is not found or available. If you play around enough with WordPress themes you will see that WordPress theme authors will use many different solutions for a 404 error page. Some are a bit more user friendly than others, and some unscrupulous theme authors will even redirect your visitors to their website with a 404 error redirect.

The latter I spoke about is how I learned to make a 404 error redirect to a specific URL. In regard to the case I spoke about above, someone contacted me to teach them how to upload a few “custom” PLR WordPress themes they had purchased. First let me say that these themes were total junk and just a modified version of the default theme with a different header graphic (that needed to be edited) and of course the sellers links embedded all throughout the theme. Don’t get me wrong a good WordPress theme author should have a link in at least the footer in return for the free theme. But in this case it was like stealing traffic especially for such a crappy theme. It wasn’t bad enough that the links were scattered throughout the theme, the theme actually redirected the visitor away from the blog if a 404 error occurred.

Here is how easy it is to do if your theme has a 404 error template file (404.php) and you want to specify an actual URL to redirect your visitors to for the 404 error. Simply use this code in the entire 404.php file and then specify the actual URL:

<?php
header( ‘Location: http://www.ChangeToActualURL.com’ ) ;
?>

There are other methods and solutions like on this site, at the time of this post, it redirects to a page that offers to search the site, or click some AdSense ads, hey I have kids to feed! This is done using code that is actually within the main index file instead of a separate 404.php file. There are so many different WordPress themes and each author has their own idea of a 404 error page so I can’t possibly give solutions for each method in this post. But you should make sure your visitors are not getting hijacked by a pirate WordPress theme author or theme reseller!

Similar Posts:

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Tagged with: ,



7 Responses to "Create A 404 Error Redirect For WordPress"

  1. This is great…it’s quite useful to every webmaster to include a 404 page.

  2. I had no idea it was that easy Thanks so much for the tip.
    That’s a much better way to use a 404 page

  3. How rude of them to add that to a free theme. I already know a lot of php so this was not new to me, but putting it in a 404 page is quite clever.

    Thanks for the tips!

  4. Very useful tips on using 404 pages.

    Alan Thomas / Simple Work From Home Opportunity

  5. Really useful tips on 404 error page. Its a great tips for every webmaster . Thanks for sharing.

  6. Very useful tips for redirecting 404 page

  7. Very useful and implementing on all of my sites.

    Thanks!

Discussion Area - Leave a Comment

If you have a question about your blog please leave a link to it. Please don't ask questions like "Why don't my blog work right?" and expect an answer. I can't fix stupid.

Two links or less are welcome, any more and your comment will be spammed! Nofollow has been disabled, feel free to use your keywords or site name as your name for anchor text. Some comments may be moderated and will not appear until approved. Please submit only once.



XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Or just copy the example below and change your details.
Example - <a href="http://www.YourSite.com" target="_blank">Title Of Site</a>




Have a Gravatar Yet? Get one at Gravatar.com