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 use Lunarpages and have set up a few add on domains to my main account. These show up as sub-domains of my main account, but they can be reached by using the new domain I've created.

So:

subdomain1.example.com --> www.example1.com
subdomain2.example.com --> www.example2.com

The problem is that example1.com shows up in Google with that domain but example2.com shows up with subdomain2.example.com. I'd the Google search results to display the domains without using a sub domain.

share|improve this question

migrated from superuser.com Feb 25 '11 at 6:27

This question came from our site for computer enthusiasts and power users.

add comment

2 Answers

Had the same problem with another provider and it is really not their fault. It is still a mystery to me how Google was able to find the subdomain path since I never wrote it anywhere.

The more robust solution is to setup your .htaccess so to give a 301 redirect when the wrong domain is accessed. For completeness I also do it for the non www version of the domain. That way Google always resolves and attributes PageRank to the official name. This is simple to do as long as .htaccess are enabled and setup properly.

Here is what one of mine looks like:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^realdomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^subdomain.realdomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.subdomain.realdomain.com$
RewriteRule ^/?(.*)$ http://www.realdomain.com/$1 [R=301,L]
share|improve this answer
add comment

I've seen this in apache when Vhosts are not configured properly, I'd suggest talking to your host as they will probably have to do the work on the server (unless you manage your own servers).

If you can't get it resolved through your host you should be able to create a 301 redirect using an .htaccess file (it's better to fix the server configuration though if you can).

share|improve this answer
add comment

Your Answer

 
discard

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