Domain resolution query

Associate
Joined
6 Jan 2009
Posts
1,191
Hi,
Wondered if you could help me out. I have 2 domains, one of which is my main site (domain1.com), the second being a related domain (domain2.com). I want to use the secondary domain to resolve directly to a particular page on my main site.

Am I right in thinking I need to create a custom DNS entry on my secondary domain, e.g. www.domain2.com -> CNAME = domain1.com/mypage.

Cheers.
 
If your using Apache then you can do it via a rewrite rule in .htaccess. First park the domain on your original domain. do you want the URL to change to your original domain or stick with your secondary domain? This will decide the exact nature of your rewrite rule.
 
Depends on your host, but yes it is possible. Have domin2.com resolve to the same IP and have the web server 'listen' on both domains for this directory (usually just 'parked domains' on most hosts). Hope you did not use any absolute links in your HTML code :D
 
Am I right in thinking that it would be better from an SEO perspective for domain2.com to 301 redirect to domain1.com/mypage?

If so, presumably I would create an entry in the .htaccess file on the secondary host, e.g. "Redirect permanent / http://domain1.com/mypage" ?

Problem is, the secondary domain doesn't have hosting. So what would I do, change the name servers for the secondary domain to target my primary domain name servers and then create some kind of rule in the index of domain 1? Sorry for the annoying questions.
 
OK, been thinking further about this.

Surely I just need to create a new DNS entry on domain2 so that "domain2.com" has a CNAME entry of "domain1.com" ? Can I go as far as adding a specific URI to the CNAME record, e.g. "domain1.com/mypage" ?

Thanks
 
Why not park the second domain with your host and do a 301 permanent redirect in .htaccess? I don't think it's possible to use CNAME to redirect to a specific page. You need some server side work in there also.
 
Last edited:
OK, been thinking further about this.

Surely I just need to create a new DNS entry on domain2 so that "domain2.com" has a CNAME entry of "domain1.com" ? Can I go as far as adding a specific URI to the CNAME record, e.g. "domain1.com/mypage" ?

Thanks

No, DNS can't do that - its job in essence is to resolve a host to an IP address and vice versa.

If you want to specify paths beyond a domain name for a specific record to resolve to then that is beyond the scope of DNS. You'll need to use htaccess rules. A CNAME record will just be an alias for another record only. For example you can alias domain2.com to point to test.domain1.com but not domain1.com/test.
 
Back
Top Bottom