Forum Moderators: phranque

Message Too Old, No Replies

Multiple Domains permanent redirect to the same website but keep the s

         

AnnaK

10:45 pm on Feb 25, 2009 (gmt 0)

10+ Year Member



Hi, I hope someone can help me, please.

I have Multiple Domains and one web site.

I would like to redirect secondary domains to the same website but keep the secondary domain’s name unchanged on the address line in the browser and therefore make the redirect transparent to the user but at the same time to avoid the duplicate content penalty from the Search Engines.

I tried to achieve it in a few different ways by:

1. Creating a Symlinks through command line on the server
2. Forwarding secondary domains to the main domain
3. Using mod_rewrite code in the .htaccess file for each secondary domain.

The redirect works fine in all three methods, however it ALWAYS CHANGES the web address from secondary domain name to the main domain name.
Maybe I am doing something wrong or the problem comes from the WP or the server setup?

I spent a lot of time on the web trying to find an answer on what I am doing wrong, but I could not figure it out, never mind that I am not a web developer.

In any case, here is what I am working with:
1.The web site resides on the Apache server with mod-rewrite enabled
2.The web site was developed using word press
3.All the domains including main domain reside on the same level

Folder “Domains”--> Main domain --> html folder -->.htaccess file
--> Domain 1 -->html folder -->.htaccess file
--> Domain 2 -->html folder -->.htaccess file
-->Domain 3 -->html folder -->.htaccess file
-->Domain 4 -->html folder -->.htaccess file

1. When the .htaccess file was created for each individual domain (through the server) it contained the following Default code:
Redirect 301 / [maindomain.com...]
Result: the url address still changes from secondary to main domain
2. My first version:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^secondarydomain\.com [NC]
RewriteRule ^(.*)$ [maindomain.com...] [R=301,L]

RewriteCond %{HTTP_HOST} ^www.secondarydomain\.com [NC]
RewriteRule ^(.*)$ [maindomain.com...] [R=301,L]
Result: the url address still changes from secondary to main domain

3. My second version :
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^secondarydomain.com [NC]
RewriteRule ^(.*)$ [maindomain.com...] [L,R=301]

RewriteCond %{HTTP_HOST} ^www.secondarydomain.com [NC]
RewriteRule ^(.*)$ [maindomain.com...] [L,R=301]
Result: the url address still changes from secondary to main domain
4.My third version:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^secondarydomain\.com [NC]
RewriteRule ^(.*)$ [maindomain.com...] [L]
Result: the url address still changes from secondary to main domain and I don’t believe that it is permanent redirect since it does not have R=301.

Thank you very much for the help!

g1smd

11:28 pm on Feb 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



*** I would like to redirect secondary domains to the same website but keep the secondary domain’s name unchanged on the address line in the browser and therefore make the redirect transparent to the user but at the same time to avoid the duplicate content penalty from the Search Engines. ***

What you are describing in that paragraph is a rewrite, not a redirect. However, your two requirements are mutually exclusive things; that is, as far as rewrites/redirects alone are concerned.

If the user continues to see the same non-canonical URL they requested, then by definition that *is* duplicate content.

If you want to fix that problem you must redirect all client requests for the non-canonical URL to the canonical URL. That is what your code examples actually do. They produce a 301 redirect and that *is* the best way to fix this problem.

There are other ways, but they are not recommended. One is to dynamically add a meta robots noindex tag to all of the pages when they are served via a non-canonical domain. That will still cause your site to have PageRank issues because incoming links would be spread over multiple domains but it would stop duplicate indexing.

Alternatively, this might be a use for the new "rel=canonical" tag, but I wouldn't want to be the first one to test it out. :-) The 301 redirect method is 'tried and tested' and still remains the default recommendation for this.

I would go with having one canonical domain, and redirect all of the others. Make sure you cater for both www and non-www at all levels too.

AnnaK

4:45 pm on Feb 26, 2009 (gmt 0)

10+ Year Member



Thank you very much for the quick response.
I'd like to explain why I am trying to do what I described in my previous post. Maybe you will have some suggestions on how to do it.

My old site was setup by using multiple domains and the domain names served as additional keywords in the search results. Unfortunately, I don't know how it was done then. The new site resides on the new server and the old code is gone.

Could you please give me the specific instructions on how to use the new "rel=canonical" tag for my purposes.
Thank you.

AnnaK

5:01 pm on Feb 26, 2009 (gmt 0)

10+ Year Member



I just want to clarify - I have only one website and multiple domain names. Would "rel=canonical" tag apply to my situation?

jdMorgan

5:36 pm on Feb 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You cannot both "redirect and keep the original URL" -- This is a contradiction in terms, since a redirect by definition must ask the browser to re-request what it was looking for, but using a new URL. When the browser complies, it updates its address bar -- To do otherwise would allow massive security exploitation of Web users.

Furthermore, an internal rewrite is no longer necessary (or sensible) if all domains now point to the same server and the intent is to serve the same files within that server for all these domains.

What you now have is a duplicate-content problem, and there is no way to resolve it other than ceasing to use the extra domains for their very small keyword-in-domain benefit, and instead redirecting them all to the main domain. This would concentrate the incoming links and PageRank/link-popularity on that one domain (in effect, stopping your domains from competing among themselves), and this would be "playing fair" with the search engines by not trying to get multiple listings for the same content; If you don't play fair, then the sites will be competing with each other, and the search engines' back-end duplicate-content filters will detect that dupe-content, pick one of your domain-page-URLs to favor (taking that choice out of your hands), and demoting the rest of the URLs that lead to the same content.

I suggest implementing a 301-Moved Permanently redirect from all additional domains to the main domain, and promoting only that main domain on the Web from now on. You may continue to use the alternate domains for print, radio, PPC, and TV ads, just don't link to them any more from within your own sites.

I believe that you will find that focusing all of your "link power" and PageRank on one domain will yield better results than trying to get the small benefit from keyword-in-domain factors. However, feel free to pick any one of your existing domains as your main domain, based on existing incoming link factors, "brand-ability," and both keyword-in-domain ranking and clickability factors.

The alternative is to set up separate and unique sites on each domain -- really separate, and really unique.

HTH,
Jim

AnnaK

6:20 pm on Feb 26, 2009 (gmt 0)

10+ Year Member



Thank you very much, Jim. You definetly help to clarify.
Luckily I am 301 redirecting all domains to the main domain, so no harm was done, I just wanted to get as you said "keyword-in-domain benefit". Oh well...
Could you please tell me which version of the .htaccess file in my first post(since they all worked) is the best version to use (#1, 2, 3 or 4)?
Thanks

jdMorgan

7:09 pm on Feb 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The "best" is probably a single rule to take care of *all* non-canonical variations of domain, casing-errors, FQDNs, and appended port numbers:

RewriteEngine on
#
# If not *exactly* the canonical domain or blank,
# externally redirect to the canonical domain
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

This redirects the following variations, as well as all others:

example.com
xyz.example.com
www.ExAmple.Com
www.example.com.
www.example.com:80
www.example.com.:80

all of which are valid, but non-canonical.

Note that an allowance is made for true HTTP/1.0 client requests, which will not send an HTTP Host request header. The result is that the %{HTTP_HOST} value will be blank.

These requests cannot be redirected, because if they were, the client would simply respond with a new HTTP request -- also with a blank hostname. This would result in an 'infinite' redirection loop.

While this is only a concern for sites which have a unique (non-shared) IP address, the small code change is cheap insurance even if you're currently on a shared IP address; You might later end up on a server with a unique IP address, and then you'd have to figure out why your server is getting hammered by redirection looping six times a year -- unless you remembered this thread!

Most true HTTP/1.0 clients today are deployed by people with less than honorable intent; they are quite obsolete at this point in time. Because of this, you can't count on them to give up on redirection looping; They might keep making requests and getting redirected. So in effect, failing to handle this could result in a self-inflicted denial=of-service attack!

Jim

AnnaK

7:21 pm on Feb 26, 2009 (gmt 0)

10+ Year Member



I am very sorry, but this is a bit too technical for me to understand. Would it be correct to have a one line .htaccess file for the secondary domain as follows:
Redirect 301 / [maindomain.com...]
OR should it be like that:
RewriteEngine On
RewriteBase /
## non-www
RewriteCond %{HTTP_HOST} ^secondarydomain\.com [NC]
RewriteRule ^(.*)$ [maindomain.com...] [R=301,L]
## www
RewriteCond %{HTTP_HOST} ^www.secondarydomain\.com [NC]
RewriteRule ^(.*)$ [maindomain.com...] [R=301,L]

Thanks

jdMorgan

7:51 pm on Feb 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe that you have stated that all domains point to the same filespace. If so, then the single rule I gave you, located in the main domain's root .htaccess file, will take care of *all* domains.

Jim

AnnaK

8:01 pm on Feb 26, 2009 (gmt 0)

10+ Year Member



Many, many thanks to you, Jim