Help with CNAME redirection

stumper

New member
Joined
Mar 25, 2014
Messages
2
Hi all, I have a task but don't know exactly how to go on about it... well, someone else's sub-domain (sub.otherdomain.com) wants to have it point to my subdomain (store.mydomain.com) and he wants to achieve this using only CNAME. That is, even though the contents are of store.mydomain.com, he wants to have sub.otherdomain.com on the address bar. We both use directadmin as our CP and I would really appreciate if some one could explain the process required for this. Thanks.
 
You likely can't do it easily with only CName.

All CNAME does is directs packets to be routed to your server. Once there, two issues arise:

1. How does apache know which site on your server is the right site? Without a header with your domain name in it apache doesn't know, it can only send the request to the first domain set up for that IP#. To overcome this hurdle your subdomain (not the main domain but the subdomain) must be the first domain listed for it's IP#. The easiest way to do that is to set up the subdomain as if it were a main domain, and give it it's own IP#.

2. Once apache knows which site (in other words, hich public_html diretory on your server) gets the request, your shopping cart software must know that his domain name is a valid domain name for that shopping cart. If your shopping cart cares, then you may not be able to do this anyway. If it doesn're care then you may e able to do this, but any domain-based links in the shopping cart will still show the domain name on your server in the visitor's browser. If the shopping cart is built with dynamic links, then they may work, except if there are any links from the shopping cart go between http and https, as such cross-protocol links must be specific links with protocol, so they'll always be to your domain.

3. All else above okay? Does your shopping cart have a secure Certificate to present pages securely (https vs http)? If so, you'll need to replace your Certificate with a multi-domain certificate. Perhaps at significant additional cost.

Some shopping carts may be designed for this kind of linking, but as you can see above, there are a bunch of hurdles to go thrugh.

Jeff
 
Thanks sir, for the valuable info. Now, I have a vague idea on how these things work. Meanwhile, I guess I wasn't that specific on my previous post. I am using a xen VPS with DA internal license and the other person, who wants to have his subdomain pointed to my subdomain, is on a shared hosting with access to dns control for his domains. As you mentioned on your previous post, adding the CNAME record on his end, points to my 'main' subdomain (user.mymaindomain.com), which is not exactly mydomain.com where the contents are hosted. I have only one IP4 but 3 IP6 addresses. Regarding your suggestion on creating a main subdomain to host all my contents and accept CNAME requests from every client is simple very practical. However, I will be creating multiple clients' specific subdomains on mydomain.com.

My further questions are-
So, how do I make apache to direct a particular request from a client's sub.otherdomain.com to land on his specific subdomain on my sever (sub1.mydomain.com) and a second client can also have his sub.otherdomain1.com to land on my sub2.mydomain.com?
 
As I understand your question, you need to have the final destination set up as it's own user even though you're calling it a subdomain, and also with it's own IP# so you can install it's own Certificate with it's own Certificate.

Or conceivably you could have an IP# for one subdomain: mysubdomain.example.com, and then install a multi-domain Certificate for that subdomain, but each time yu ade a user you'll need to get him his subdomain name as an alias in DirectAdmin to your subdomain. And if you need a secure connection for his visitors you'll need to get a Certificate that enables multiple dmain names, and get a domain name added to your Certificate (and get a new copy and install it), each time you add a customer.

A much simpler way to do this would be for him to host his sudomain on his site, but the contents would only be a set of frames, the first frame being empty (but seving to keep his subdomain name shown in the browser window) but your subdomain called in the second frame. That may or may not trigger browser errors for Secure Certificates; it didn't for me the last time I did it that way, but browsers have changed a lot since then.

Jeff
 
Back
Top