Redirect all broken/deleted pages which are backlinked to homepage on a HTML website?

XrumerGeek

Supreme Member
Jr. VIP
Joined
Nov 14, 2011
Messages
1,473
Reaction score
1,635
I've recently bought an expired domain and thrown up a basic HTML 1 page site for a service based website.
Some of the backlinks link to deep pages and therefore are broken.
As a temporary measure until I recreate the pages, how can I redirect all broken/missing pages to the homepage?

I want to do this instead of a 404 page.

Thanks
 
Can anyone offer a solution for this as I'm ready to put the site live aside from this other.
 
Fixed using the following;

Code:
DirectoryIndex index.html
ErrorDocument 404 http://domain.com/

Will this flow any link juice for the time being before I come up with a better method?
 
use .htaccess and php

Options +FollowSymLinks -MultiViews

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteEngine On
RewriteRule ^(.*) ./redirect.php [L]

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: /");
 
Your suggestion will work to send the 404 traffic to your homepage but will still return a 404 telling the SEs that the page doesn't exist anymore. The SEs may devalue the page in the SERPs so you are better off returning a 301 redirect to non existent pages.

The code below should send all traffic back to homepage via a 301 redirect which would likely be a better option for ranking purposes while still accomplishing what you want:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L,R=301]

Change the page name if index.html is not your homepage address and definitely check it all works as you expect before walking away from it.
 
how can I redirect all broken/missing pages to the homepage?
Redirecting all 404s into the main page works badly in terms of SEO. That's what 99% of seo people do, come to think of it.
 
Your suggestion will work to send the 404 traffic to your homepage but will still return a 404 telling the SEs that the page doesn't exist anymore. The SEs may devalue the page in the SERPs so you are better off returning a 301 redirect to non existent pages.

The code below should send all traffic back to homepage via a 301 redirect which would likely be a better option for ranking purposes while still accomplishing what you want:


Change the page name if index.html is not your homepage address and definitely check it all works as you expect before walking away from it.
Thanks for that. It's implemented and looks good!

Redirecting all 404s into the main page works badly in terms of SEO. That's what 99% of seo people do, come to think of it.
Thanks for the advice, this is only a temporary fix until I get round to recreating the pages. It's better than nothing!
 
Back
Top