Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a hosted rails application that gives every account a sub domain eg company.hosted_site.com

I have pointed our customers own domain to their subdomain via a A record and a cname so it looks like their own site.

But now i have 2 versions of the same site running so i need to now redirect the subdomain to the customers own domain.

My question is what redirect is best for this for SEO ?

thank you Rick

share|improve this question

migrated from stackoverflow.com Apr 23 '11 at 21:59

This question came from our site for professional and enthusiast programmers.

3 Answers 3

There are a couple of things you can use. First, assuming you have signed the domain up for Google Webmaster tools, you can select the prefered version of the URL. http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html

I would also add an HTACCESS rule to redirect visitors to the preferred URL.

RewriteCond %{HTTP_HOST} company.hosted_site.com [NC] 
RewriteRule ^(.*)$ http://www.hosted_site.com/$1 [L,R=301] 
share|improve this answer
    
+1 Using .htaccess is usually a bit better for the server, because it goes through Apache without having to process any of the RoR code. –  Blowski Apr 30 '11 at 12:37

as long as you get 301 site moved permanently, you'll be fine, doesn't matter which method you use to redirect, you just need to make sure to set the code properly.

share|improve this answer
    
It's correct to use 301, but I think it does matter which method you use. HTML or JavaScript redirects can be disabled on the client side. Using Apache, either by .htaccess or in the httpd.conf usually gives the best results. –  Blowski Apr 30 '11 at 12:40

If a file/domain has has moved for good you should use a "301 Moved Permanently"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.