Aliases in cPanel – quick, dirty workaround
There’s been plenty of times when I’ve had a website up and running and for whatever reason don’t want to host the nameservers for a particular domain on those provided by the hosting company. There’s a number of good reasons for doing this, such as failover and the ability to create specialised records like ANAME records.
The problem is, that if you have your site hosted on a WHM/cPanel environment, it can be difficult to deal with test environments or additional servers that you want to host in your domain.
For example, lets say I have thisdomain.com
hosted at myhosting.com
There’s a couple of ways DNS can be configured. Typically you would update the nameservers at the registrar or thisdomain.com to point at myhosting.com
and then use the nameservers at myhosting.com
for your domain. These nameservers are fairly limited in most cases and usually don’t provide a decent failover option (if at all).
So we move DNS to a more feature-rich environment like dnsmadeeasy.com
. This is pretty easy to do. We just create an account on dnsmadeeasy and transfer the domain over to dnsmadeeasy and then repoint the nameservers at the registrar to dnsmadeeasy’s nameservers and we’re all good. We also need to update the NS records on myhosting.com so that everything points to dnsmadeeasy
thisdomain.com
and www.thisdomain.com
will continue to work fine and point to the website hosted at myhosting.com
Suppose though, that we now want to add a test.thisdomain.com
site and host it somewhere else (also WHM/cPanel – let’s call it ourhosting.com
). The easiest way to deal with it is to do the following…
- Create your account on
ourhosting.com
using thisdomain.com as your domain name and select to use existing nameservers - create an A record on dnsmadeeasy for an arbitrary host pointing to the new hosting environment (e.g.
temp.thisdomain.com
) - create an NS record on dnsmadeeasy for
test.thisdomain.com
pointing totemp.thisdomain.com
- Park
test.thisdomain.com
on top ofthisdomain.com
atourhosting.com
using the domain parking tool in cPanel
That’s it. You’re done. Now you have two websites hosted with two different providers using different hostnames in the same domain. This handy workaround means you don’t have to host your subdomain (test.thisdomain.com
) on the same host as your primary website (www.thisdomain.com
)
Remember, this is a work-around and not the politically-correct way to do things, but we’re not big on political correctness here at ContinuIT. We just make stuff work!
Tags: aliases, cPanel, domain, hosting
Trackback from your site.