Forum Moderators: phranque

Message Too Old, No Replies

Permanently move ALL pages from olddomain to newdomain index

         

fatabbot

3:16 pm on Jul 12, 2009 (gmt 0)

10+ Year Member



Hello,
I would like to permanently move everything from olddomain.com to the INDEX page of newdomain.com

To give a few examples:

[olddomain.com...]
[olddomain.com...]
[olddomain.com...]
[olddomain.com...]

It should all redirect to [newdomain.com...] - without keeping the folder structure or any parameters. Any possible url of olddomain.com should redirect exactly to newdomain.com - Parameters should also be leftout.

Can this be achieved with a single redirect rule in htaccess?

Best regards,

jdMorgan

4:09 pm on Jul 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, but it's a really bad idea...

It is a very poor method for usability, and leaves the visitor confused -- Many of them will leave immediately. It also creates massive duplicate-content issues which may negatively affect the ranking of your site's pages in search engines. for more info, see the "Google Hot Topics" thread pinned at the top of our Google News forum, and search this site for "duplicate content."

The proper solution is to redirect each of your best-ranking and highest-traffic old URLs to a logical new replacement URL, and to return 410-Gone (or if not possible, 404-Not Found) for the other URLs which have been removed. Then set up a custom error document for 410 and 404 errors that briefly explains the situation (The page you were looking for has been removed/cannot be found), and provide links to your home page, category pages, main site-section directory pages, site map, and on-site search facility, etc. Help the visitor find what they were looking for.

If you decide to proceed despite these risks, then please post your best-effort code as a basis for discussion as outlined in our Apache Forum Charter [webmasterworld.com]. You may opt to use RedirectMatch (Apache mod_alias) or --if you already use mod_rewrite (or plan to)-- RewriteRule. Generally, you should not use both of these modules if you wish to control code execution order.

Jim

fatabbot

4:20 pm on Jul 12, 2009 (gmt 0)

10+ Year Member



Hi jdMorgan,

I know it's a pretty bad idea for usability, but I don't have another choice, as my old site was completely wiped away due to a hardware failure. I had literally over 300.000 indexed in google and they are all gone. My dynamic pages are gone, including all content, which was stored in a database, which is corrupted due a harddrive failure.

I have no other choice than to redirect everything to the main index of the new url. Is there a better solution for this, from an SEO perspective? I don't want the new url to get penalized. The pages on the old domain simply don't exist anymore, so I'm not sure how to handle this. It's a huge loss, but I have to do something with the old pages, as they are linked to from all over the web.
any ideas?

icedowl

4:42 pm on Jul 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



fatabbot, this is just a thought, but I wonder if there's any way that the web archive could help you regain some (or all) of your old content. It helped me last year when someone hacked one of my sites.

fatabbot

4:46 pm on Jul 12, 2009 (gmt 0)

10+ Year Member



icedowl, i can recover some of the text, but no images :(

jdMorgan

6:48 pm on Jul 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nevertheless, I suggest that you use the procedure outlined above. This is in accordance with the HTTP protocol specification, and it is best to 'follow the rules' if you want search engines to be nice to you.

Requests for your home page can be served by your new home page. Requests for other (missing) pages should be served with a 410 or 404 error response. Both pages should briefly explain to your visitors what happened and what you plan to do about restoring the site (and approximately when).

Use 410-Gone for URLs that you don't plan to 'recover' or replace. Use 404 for pages that you plan to put back as you rebuild.

So sorry to hear about you losing your site. I assume you've learned the hard lesson, and won't allow this to happen again.

Jim

fatabbot

6:59 pm on Jul 12, 2009 (gmt 0)

10+ Year Member



Thanks jdMorgan
I'm surely taking offsite backups now eventhough it can be expensive for large content sites.

I'm just new to the permanent redirect stuff and I need to set this up right as soon as possible.

How would I set on my old domain that only the main index redirects to the new index and all the rest ends on 404?
Should the 404 page show on the new domain or on the old one?

jdMorgan

12:38 am on Jul 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To redirect the index page "/" from the old domain to the new domain, you'd put this in the server config file or top-level .htaccess file on the old domain:

RedirectMatch 301 ^/$ http://www.newdomain.com/

Technically, the 404 and 410 responses should come from the old domain, but the error pages on the old domain can and should show links to the index, site map, category pages, and site search (etc.) pages on the new domain.

Do NOT set up the ErrorDocument directives on the old domain to point to error pages on the new domain. If you do, the old domain server will return a 302-Found redirect status instead of the proper error code, and this may massively confuse the search engines.

Be sure to review the Apache module documentation [httpd.apache.org] for all directives that you use. The topics we've covered so far include mod_alias (RedirectMatch) and mod_core (ErrorDocument). Reading these documents may give you the opportunity to spot a potential problem caused by forgetting to mention something in your posts here, or caused by an incorrect assumption made by someone who replied to you here. We are discussing server configuration -- a subject not to be taken lightly. Therefore, you should check the solutions presented here against the Apache documentation, and make sure that those solutions "make sense" for your site when interpreted using the information in the documentation.

Jim

fatabbot

8:46 am on Jul 13, 2009 (gmt 0)

10+ Year Member



Thanks jdMorgan, I've implemented your suggestions... I just hope it wasn't too late as I've been redirecting everything to the main index of the new site for a while...
So now I did the following:

In Htaccess of the old domain, I put:
----
RewriteEngine on

RedirectMatch 301 ^/$ [newdomain.com...]

RewriteRule ^404$ 404.php
RewriteRule ^404/$ 404.php

ErrorDocument 404 [olddomain.com...]

---

Which means that everyone who goes to [olddomain.com...] gets permanently redirected to [newdomain.com...]

Everyone who visits an internal page of www.olddomain.com (either via search engines, bookmarks or via other websites linking to it) will end up on [olddomain.com...]
Which has an explanation of what happened and how this page might be recovered.
It also has the full menu with a link to the home of the new site, and links to all important category pages on the new domain.
Does all this look right? Or am I missing something?
I'll read more about the directives now.
Thanks

jdMorgan

2:42 pm on Jul 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure why you did this bit, and there is a dangerous problem with it:
RewriteRule ^404$ 404.php
RewriteRule ^404/$ 404.php
#
ErrorDocument 404 http://www.olddomain.com/404

Those three lines could be replaced with just one:

ErrorDocument 404 /404.php

Specifying a *local* URL-path as ErrorDocment will return a 404 status to the client. Using a full URL as you did above will result in a 302 redirect, and this will make a mess of your search listings. This behaviour is documented, so again I recommend that you check the Apache documentation before using any Apache directive.

Also, I suggest that you download and install the Live HTTP Headers add-on for Firefox and Mozilla-based browsers (or something similar), and thoroughly test your redirects and error responses -- Look at the status response headers and (when applicable) the redirect "Location" header URLs returned by the server, and be sure that they are right. For example, Live HTTP Headers will clearly show the 302 redirect response instead of the expected 404 if you test the ErrorDocument directive you posted above.

Jim

fatabbot

3:38 pm on Jul 13, 2009 (gmt 0)

10+ Year Member



You're right... I tried with the firefox plugin and it was a redirect instead of 404. I changed it and it's 404 now for all missing pages.

The question that comes to mind is: Can any of those things harm the NEW domain? It would be logical to assume that there is no way that one domains actions can do any harm to another domain, as this would be open to abuse.
Assuming that someone wants to do harm to a competitor and his rankings in the SE's... he could just build up a site with bad reputation, black hat seo, get penalized and removed from the se's and then do a permanent redirect to a competitors site, or put a 404 of a different url from a competitor.
Is it safe to assume that none of the mistakes done can do harm to a new domain?