Using 404 Redirects to Benefit from Links into Subpages
If search engines like Google end up on a 404 error on your website subpages, they not only stop crawling, they also don’t count that link. Which means it is completely useless for your domain, and it will not benefit from this link.
Simple and Easy 404 redirect solution
Step1: Modify .htaccess file
Connect to your hosting account and modify the .htaccess file which is located in the root folder. Please use Notepad or other text editors, which don’t make any formatting changes.
Add this to your .htaccess file:
ErrorDocument 404 /error.php
Step2: Add the error.php file
Next you have to create a new php file which redirect all traffic to your root page using a permanent 301 redirect.
header(“HTTP/1.1 301 Moved Permanently”);
Replace yourdomain.com with your domain name and leave everything else as it is.
Upload this error.php file also into the root folder of your website.
That’s it – you’re done.
All traffic to none existing websites are redirected to your root page or whatever URL you add to the error.php
You can also download both files from our server here: 404 redirect files