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 main site with a bunch of subdomains created. Each subdomain is a blog and I want each blog to have its own domain name i.e.

thisguy.com -> blog1.mainsite.com thatguy.com -> blog2.mainsite.com

I bought the new domains and I set up the CNAME records as above to alias them to the appropriate subdomains. However, I get my hosts "a domain is pointing to one of our servers but we don't know anything about it" landing page.

How can I set up these domains as aliases of my subdomains?

share|improve this question

2 Answers 2

You need these entries in the .htaccess file at the root of your hosting (i.e. where mainsite.com goes)

RewriteCond %{HTTP_HOST} ^thisguy.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.thisguy.com$
RewriteRule ^/?$ "http\:\/\/blog1\.mainsite\.com" [R=301,L]

and so on for thatguy.com and blog2.

share|improve this answer
    
I get the parking page for my web host because it does not know where to go with the domain - it doesn't even get to my main site. –  user745668 May 27 '11 at 16:05

This is probably an issue with your Apache setup. You'll need to add

ServerAlias thisguy.com

To the blog1.mainsite.com vhost config. It goes in the same level as ServerName.

share|improve this answer
    
That works! sort of! now I have thisguy.com aliased to mainsite.com but how do I alias it to the subdomain blog1.mainsite.com? –  user745668 May 27 '11 at 20:29
1  
There are two ways. You could use separate vhost files for the main domain and the subdomains (that's what I usually do). You could also use the rewrite rules that paulmorriss gave you in his answer. –  Chris Ting May 27 '11 at 21:17

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.