404 error pages redirect

There 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 seller’s 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!

Editorial Staff

Editorial Staff

Editorial Staff at WPArena is a team of WordPress experts led by Jazib Zaman. Page maintained by Jazib Zaman.

Leave a comment

Your email address will not be published. Required fields are marked *