Skip to main content

Subdomains vs. Subdirectories

Category: General Info.

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 and the files you’ve placed there).

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 portfolio on your new web space, 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 site. 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.

Root Domain

Let’s say you’ve registered a new domain for domains.stanford.edu called profX.su.domains. 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, WordPress), and you can set that site up at your domain’s root. To get to your site in this scenario, users would simply go to profX.su.domains.com.

Subdomains

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 (see how to create subdomain article)

As you work on your site, you’re welcome to create as many subdomains as you like, and in each subdomain you can actually create a distinct, individual Web site.

Subdirectories

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 portfolio at myportfolio.yourdomain.su.domains you would place it in a subdirectory called “myportfolio” making the address of your new website is yourdomain.su.domains/myportfolio.

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.

Tips & Review

  • 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 pretty URLs as subdomains, but they’re easier to set up. They can, however, result in conflicts with existing Web pages.
  • 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.