Forum Moderators: phranque
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,
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
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?
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
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?
RedirectMatch 301 ^/$ http://www.newdomain.com/
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
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
RewriteRule ^404$ 404.php
RewriteRule ^404/$ 404.php
#
ErrorDocument 404 http://www.olddomain.com/404
ErrorDocument 404 /404.php
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
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?