One easy way to organize your domain is to create subdomains, in which you can then install other applications. In addition, you can set up subfolders (also called subdirectories) for your site, which can also have their own applications installed in them. This guide will help you with:
Subdomains vs. Subdirectories
When you’re first getting started with a new space on a new web host, you might think of yourself as owning a small “territory” of the web. Everything you place in your public folder on the server becomes available for anyone on the web to see (assuming they know the address of your site).
If you’re just putting up a handful of static, HTML pages which you want to make available to colleagues, friends, or family by sending them links, then working with this large, unorganized space may work. But as soon as you get to the point where you want to organize your site, you’re going to need a new strategy.
Consider this scenario: you want to have a personal blog on your new website, where you share pictures and short written pieces with family, friends, and colleagues. In addition, you’re working on a large research project that requires you to build a web-based repository of digital images related to your discipline. You want to use one application (say, WordPress) to manage your personal blog. For your research project, you’ve settled on another open-source application (say, Omeka). Both of these are applications that need to be installed on your web host, but you can’t just put them both at your main domain name – if you did, both sites would quickly experience conflicts and errors. You need to cordon off separate spaces for your different web “properties.”
There are two primary strategies for parceling up your web space. You can create subdomains or subdirectories. But before you can understand the difference, you need to first understand what we mean when we talk about your root domain.
Let’s say you’ve registered a new domain called yourdomain.com. Anything that is stored at this core URL is considered to be at the root of your domain: Nothing comes before the address or after the address. You can certainly decide that you simply want to have a single site on your web host (say a blog running WordPress), and you can set that blog up at your domain’s root. To get to your site in this scenario, users would simply go to yourdomain.com.
When you want to do more than just have a single site at the root of your site, you need to decide now to organize your space. One way to do so is by setting up subdomains.
You’re already familiar with the concept of subdomains, even if you don’t know it. Consider Bryn Mawr’s public website at http://www.brynmawr.edu. As you browse parts of that site, you’ll notice that the domain changes. For example, when you look at the Digital Scholarship website, the URL is no longer just brynmawr.edu. Now the root of the url is at digitalscholarship.brynmawr.edu, indicating that you’re on the part of the site that is dedicated to information on Digital Scholarship.
As you can see the domains serve two purposes: they help to organize the site from a technical perspective, but they also serve as indications to the users that they are in a new/different space.
As you work on your site, you’re welcome to create as many subdomains as you like, and in each subdomain you can create a distinct, individual website.
The alternative for organizing your space is to simply set up subdirectories. These function much like file folders on your computer. Instead of creating a blog at blog.yourdomain.com you would place it in a subdirectory called “blog” making the address yourdomain.com/blog. Setting up subdirectory is really easy. You can create folders on the fly when installing applications (like WordPress), and you can also manually create them in your file browser.
There is one particular issue you need to be aware of. Let’s say you’ve installed WordPress to be your primary blog at yourdomain.com. Later, you decide you want to create another image gallery site on your site, and you want to place it at yourdomain.com/gallery. But, if for some reason you’ve already created a page on your WordPress site called “Gallery” then the url yourdomain.com/gallery will already be taken. If you try to create a subdirectory of the same name, you’ll get a conflict and errors.
Tips, review and example
To help you better visualize the difference, here’s an example of how you might organize your site using the subdomain vs. the subdirectory approach.
|Subdomain Approach||Subdirectories Approach|
|yourdomain.com (“root”)||Install WordPress as your “main site”||yourdomain.com (“root”)|
|course1.yourdomain.com||Install a second WordPress instance for a course you’re taking||yourdomain.com/course1|
|photos.yourdomain.com||Install ZenPhoto for a public photo gallery of your photos||yourdomain.com/photos|
|docs.yourdomain.com||Install MediaWiki for a club you belong to that wants to collaboratively edit its bylaws||yourdomain.com/docs|
|files.yourdomain.com||Install OwnCloud so you can access your files on your laptop and at work||yourdomain.com/files|
This is just one example of how you might organize your site and then use different sections to do different things. There is no one solution to this challenge, and what you do should be driven by what makes sense to you! To summarize:
Subdomains are generally a cleaner, more elegant solution to organizing your site. You’re less likely to get conflicts or errors. However, when using subdomains the process is slightly more complicated: You must create subdomains first, before you can install anything in them.
Subdirectories don’t create as attractive of URLs as subdomains, but they’re easier to set up. They can, however, result in conflicts with existing webpages.
As soon as you create subdomains or subdirectories to organize your site, you need to consider how people are going to find them. If you’ve created a new primary blog at blog.yourdomain.com, and someone goes to just yourdomain.com, they won’t see that new site. It is possible to set up redirects to avoid this issue. You can also always create links from pages on one subdomain of your site to another.
If you really just need one site, sometimes installing at the root of your domain is the easiest thing to do, at least as you’re getting started. You can always add more pieces to your territory later with either subdomains or subdirectories.
Setting Up Subdomains
A subdomain is one way of organizing and separating content on your site. To create a subdomain, use the following steps:
Login to https://digital.brynmawr.edu/dashboard/ with your Bryn Mawr username and password to access your control panel (cPanel).
Once logged in you’ll be at the homepage of your control panel. The easiest way to navigate the panel is using the main search box. Click the Search box and type “subdomains” (without the quotes). When you press enter, you will automatically be taken to the Subdomains page. Or, you can scroll down and click the Subdomains button on the cPanel.
Choose a name for your subdomain and type it into the Subdomain box. Just like top-level domains (e.g. brynmawr.edu), subdomains can only contain numbers, letters, and hyphens, and the best subdomains are simple, short, and descriptive.
Once you’ve typed in a name, cPanel will automatically populate the Document root field for you. This will create a folder to contain your subdomain’s files. You’ll usually want this folder to match the name of your subdomain, so it’s easy to identify where different files live in your account. You might want to change the document root if you already have a folder in your account that has the same name as the subdomain you are trying to create, although this should be rare. Once you’re done, click Create.
If everything went well, you should see a message that your subdomain was created successfully. Your subdomain will now be available as an option for automatic installation of various software (WordPress, MediaWiki, etc).
Video Tutorial & Ideas
Although your cPanel may look different, this video, from the University of Oklahoma, explains what subdomains are and how to create them.