Beginning Web Developer Course: Setting Up Your Domains

By David Fiedler

Previously in this series, we got familiar with the cPanel interface for your shared hosting account, and learned how to redirect secondary domains to your primary account. Now we'll explore the ways to set up additional domains and subdomains for maximum flexibility--and savings in money as well.

Many From One

A subdomain is an arbitrary way of partitioning a domain that can make it act like a totally separate website. This lets you set up separate, but related, websites without paying for extra domains. For example, if your main site is company.com, you can set up subdomains such as store.company.com (for your e-commerce site), staff.company.com (for your secure company intranet), info.company.com (for potential investors or shareholders), etc. Each of these subdomains can have totally separate websites and even email addresses (mail sent to help@staff.company.com might go to your IT staff, while help@store.company.com could be forwarded to customer service representatives).

There's a reason for explaining subdomains first. Let's start by understanding that your cPanel account is permanently linked to the primary domain you selected when you signed up with your shared hosting provider. You also get disk space, in the form of a directory with the name of your account (generally something like /home/account).

Since you only have one account, any new domains you set up are implemented as subdirectories of that directory (for instance, /home/account/extra). They're technically implemented as subdomains of the primary domain as well, so if you start with company.com and then add extra.com, extra.com will appear as extra.company.com in various places within cPanel. This is an unavoidable complication of shared hosting combined with the design of cPanel, but this will help you understand why cPanel documentation keeps talking about subdomains and addon domains at the same time. "Addon domain" is simply the cPanel terminology for the standard concept of buying a new domain and setting it up as a website.

Creating An Addon Domain

Clicking on the Addon Domains icon gets you to this form:

If you've already registered your domain and set its name servers to be the DNS servers at your hosting service (as described in this article), you'll be able to fill out this form confident that your new addon domain will work properly.

First things first: type your addon domain name in the top box. Then you're asked to pick a subdomain username, which you can now understand is simply an opportunity to choose a login name for the addon domain's administrator. When asking for the Document Root, cPanel simply wants to know what you want to name the subdirectory that the addon domain will use as its home directory (it's recommended to simply use that domain name or a shortened version).

Finally, you'll select a password and type it again in the usual way, only this triggers a real-time password evaluation which shows the relative strength of the password on a colored bar graph. Since most people never change their passwords anyway, you might as well pick a good one in the first place (over 80% strength is recommended, or just use the handy popup password generator.

Free Parking

Many people like to buy domains in advance of when they'll need them, or extra names, possibly with alternate spellings or TLDs (such as domain.net and domain.info when you already own domain.com), that will resolve to a particular website. The cPanel term for this is a Parked Domain. Try not to confuse this with the general Internet-wide understanding of a parked domain, which is essentially one that isn't being used and which points to a page that says something like "This domain may be for sale, contact the owner at owner@domain.com".

Again, you have to register the domain and set up the DNS as usual, but after that, just click the Parked Domains icon and enter its name in the form field. This is the simplest (and least likely to go wrong) method of pointing new domains at existing websites (or even to a particular page if you like). It even propagates the correct information to the Redirects interface section.

The "Simple" DNS Zone Editor

Editing DNS records is far from simple and beyond the scope of this tutorial series. Messing about with this can easily knock your domain "off the air", so it's recommended that you leave this section alone unless you really, really know what you're doing.

Redirects

We've saved this one for last because most of the domain changes we've just been talking about are done using those other icons. But the Redirects interface lets you have both global and detailed control over redirections; you can redirect all your domains with a single command, or play with individual pages.

The first thing to know (especially in terms of SEO) is that virtually all the time, you will want to choose the Permanent (301) style redirection, as that actually updates the search engines when they come visiting. The second thing is that here is where you can choose whether your site's canonical URL will have the prefixed "www" or not. You should select either one style or the other, or else you'll be clobbered with bad search engine rankings:

If you want to use "www.domain.com", then select the domain from the dropdown box, type http://www.domain.com in the "redirects to" box immediately underneath it, and select "Do Not Redirect www".

If you want to use "domain.com", then select the domain from the dropdown box, type http://domain.com in the "redirects to" box immediately underneath it, and select "Only Redirect with www".

The biggest limitation of this interface is that you can't edit redirects, only remove and recreate them. But you can create redirects for specific pages or even subdirectories, and here's a secret tip: you can test any of these redirects by simply clicking the appropriate link in the second column (at the bottom of the page in the Current Redirects table).

Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
  •  
  •  
  •  
Thanks for your registration, follow us on our social networks to keep up-to-date