Subdomains

Fill in the blank

The protocol

What protocol should your web apps use?

Your answer:
Saving
Not graded. So why do it?

Lesson topics

Alpaca

What's a subdomain?

You have a domain, like silverthoughts.org. But you want to have a bunch of websites on it. Can you do that?

Yes! Subdomains can help. A subdomain is an extended name, based on your domain name, that acts like a separate website.

Take the site you're looking at now. It's at webapps.skilling.us. That's a subdomain.

This website is a subproject that's part of Skilling. I made the subdomain webapps, and put the files for this website there. It's a separate website from the one at skilling.us.

I didn't have to pay for the subdomain. I can make as many subdomains as I want, without spending a cent. Woohoo!

More importantly, the sites don't interfere with each other. I can mess with the main site at skilling.us (add files, delete files, whatevs), and this site won't be affected.

More, more, MORE!

There's another course website, on Excel VBA programming. That's at vba.skilling.us. There's another course on web basics, at learnweb.skilling.us.

So there are four separate sites:

  • skilling.us: the main project site
  • learnweb.skilling.us: web basics course
  • vba.skilling.us: a programming course
  • webapps.skilling.us: this course

(Actually, there are more than that.)

Subdomains have folders on your servers

Each subdomain has its own folder on your server. That's how the subdomains are kept separate.

Here are the folders for the subdomains above. The ~ is a Linux thing. It stands for my user account's root folder.

Subdomain Server folder
skilling.us ~/public_html
learnweb.skilling.us ~/learnweb.skilling.us
vba.skilling.us ~/vba.skilling.us
webapps.skilling.us ~/webapps.skilling.us

The mapping from the domain (skilling.us) to the folder ~/public_html was set up by the hosting company. I didn't change it. The subdomains, I created myself. I could have called the folders anything I wanted (e.g., anything-i-wanted), but I gave the folders the same names as their subdomains, to keep things easy for myself. Easy is good.

Georgina
Georgina

Wait. Can a dot be part of a folder's name?

Yes. In Windows, too. Give it a try. Create a new folder with a dot in its name.

Georgina
Georgina

OK... Hey! It worked!

Making subdomains

You can have subdomains on your domain, too. For example, you can have one for your final project, and another for your other exercises. Keeping everything separate means that your files won't collide with each other.

Let's do it.

Note

If you forget how to make a subdomain, come back here for a reminder.

Click the Domains icon on your cPanel home page, and create a new one. Type the name of the subdomain you want for your final project, like final.ragingmonkeys.com or final.doggosrule.net.

cPanel will suggest a name for the Document Root (File System Location). That's where the files for your subdomain will be kept on your server. We'll work on that in the next lesson. Make the root the same as your domain name, to keep things simple, but you can make it something else if you like.

Do not check Share document root.

Here's what I did to make a new subdomain:

Subdomain form

The Document Root is the folder where the files for your subdomain will be kept. We'll work on that in the next lesson.

Now make another subdomain. Call it "exercises". Note the document root. It will be something like exercises.yourdomain.com.

Exercise

Exercise

Subdomains

Make a screen shot of your subdomains cPanel page, showing at least the subdomains final and exercises (or whatever you called them). It might look something like this:

Subdomains screen

I have about 40 subdomains (really!). Your list will be different.

Summary

  • A subdomain adds something to the front of a domain, like rosie.doggos.com.
  • Subdomains act as separate websites.
  • Create as many as you want, from cPanel.

Up next

Let's see how you mess with files on your server.