When someone access a certain page on your site without successful like the page has…
When someone accesses to a page which is no longer available on your site or you accidentally type in one of the page/file/… in your blog, the 404 error page will popup; if the reader see this page, most of them get out right away, but you want to keep them on your site a little bit longer so how to do. How to get them seeing your other pages especially your ad placing like Google Adsense. Here are steps by steps how to edit your WordPress blog theme redirecting 404 error page to your blog homepage.
Example: When I access one of my old page named “how to make money” on my www.allchit.com blog, http://www.allchit.com/how-to-make-money, the following screen with
“Sorry. The Page of File you were loading for was not found.”
message pops up.
What am I going to do now? Here are steps by steps how to do solving this problem.
Step #1: Login your Administration screen and then click the drop down where “Appearance” is located (on the left side of the screen). Next, click “Editor“.
Step #2: Now, your theme’s stylesheet (style.css) appears. Next, click on “404 Template (404.php)” from the right side of the screen and under the “Templates” section.
Step #3: The important stuffs are right here in this step. Locate “<?php get_header(); ?> inside 404 Template (404.php) screen and then, add the following code above it.
header(“HTTP/1.1 301 Moved Permanently”);
header (“Location: /”);
Step #4: Here is how it’ll look like.
Now, just click “Update File” at the bottom of the 404 Template (404.php) code screen to save whatever you just changed.
Step #5: Let try loading “how-to-make-money” page again.
See the page “how-to-make-money” which is no longer in www.allchit.com blog redirect the reader back to the homepage “wpsurgery.com”
Done! It’s perfect now and no longer getting trouble with Google Adsense crawling.