This is a two part question


I have two domains

  1. domain1.com, with a subdomain (sub1.sub2.domain1.com)
  2. domain2.com, with no subdomains.

If I create a CNAME of corp.domain2.com, that points to sub1.sub2.domain1.com

Will that work? or do I need to configure anything from the domain1.com side of things?


if sub1.sub2.domain1.com is secured with a wildcard SSL, and someone visits corp.domain2.com which is just a cname for sub1.sub2.domain1.com, will the browser invoke a SSL security warning?


Part 1: Yes. A CNAME is just one record, and it is only configured in one place. It doesn't even have to point to a valid name, but you will then get an error when you try to resolve it.

Part 2: If you open a browser to corp.domain2.com and the certificate says that the name is supposed to be *.domain1.com, then yes, you will get a warning.

You could configure a redirect on your web server to tell everyone coming to corp.domain2.com, that they should visit sub1.sub2.domain1.com instead. But this will only work if they open http://corp.domain2.com/. You will still see a warning if you open the SSL version at https://corp.domain2.com/ though.

| improve this answer | |
  • Is there any way to get the name of the original host. For example if you went to corp.domain2.com, and it's really a name for sub1.sub2.domain1.com, how can I get the corp.domain2.com string using php? Would it be a $_SERVER variable? – mrc0der Nov 8 '12 at 2:03
  • Test it out, @mrc0der. Look at the output of phpinfo() for the name. But yes, you are right. It will be the _SERVER["HTTP_HOST"] variable. Also check this: stackoverflow.com/questions/2297403/http-host-vs-server-name – chutz Nov 8 '12 at 2:48
  • I have another issue now: I have a sub2.sub1.domain1.com that's a CNAME that points to sub1.domain1.com; I also have a sub3.domain2.com that is a CNAME that points to sub2.sub1.domain1.com; Now though sub2.sub1.domain1.com works fine and shows the content from sub1.domain1.com, but when i go to sub3.domain2.com it shows the content for domain1.com only, now the subdomain. – mrc0der Nov 10 '12 at 3:12

Part 1

Yes, it will work.

In domain1.com dns, you need something like follow

    sub1.sub2    IN A     "some IP address"


    sub1.sub2    IN CNAME "some hostname"

Then in domain2.com, you add the CNAME

    corp         IN CNAME sub1.sub2.domain1.com.

Part 2

There should be no warning, as SSL is IP base. Following link actually answer in details


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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