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:



Tags: ,

If you liked this post, feel free to leave a comment that is relevant to the post or subscribe to the feed and get future articles delivered to your feed reader.

Sorry but due to the spamming of a few all comments are moderated and will appear when approved and all drive-by comments will be deleted!

Comments

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

Reply

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

Reply

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!

Reply

Very useful tips on using 404 pages.

Alan Thomas / Simple Work From Home Opportunity

Reply

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

Reply

Very useful tips for redirecting 404 page

Reply

Very useful and implementing on all of my sites.

Thanks!

Reply

Thanks! nice how-to..

Reply

Another way to track and easily redirect 404 error pages is to use Errorlytics. This tool helps track the 404 errors that occur on your website, and then creates rules to make 301 redirects to stop the 404 errors from happening. It’s quick to set-up for Wordpress (and many other types of websites) and even quicker to learn and apply to your site.

Hope you check it out!

Reply

Hi
I’ve never thoght that error page 404 can be used like this way.
What a creative tips.

Reply

There are many ways to add a 404 redirect for wordpress. Personally, I use .htaccess redirects because they work better for me but your method is also good.

Reply

I prefer to use redirection plugin it is simple to use, but nice to know it can be done manually with such and ease.

Reply

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.

Reply

Leave a comment
Drive-By comments will be deleted! Like "Thanks for sharing", "Nice post", or any other text that doesn't contribute to the discussion. If you ask a very specific question about your particular WordPress theme, it will probably be deleted. I can fix your WordPress site but for a price. If you ask a question like "Why don't my blog work right", it will be deleted. If you ask a question about your WordPress site without a leaving a link to it, it will be deleted. The point is to ask questions and or comment on the the actual content of the post, and to please use some common sense. All comments are moderated and will appear when approved. Thank you.

(required)

(required)