In some cases, you may want to run multiple websites using a single domain. It may be that you need a test site, or you want to run a separate WordPress install from your main one. Either way, using a subdomain is your best bet. That is, as long as you know how to create one and install the platform on it.
Fortunately, this process is very straightforward. Most hosts enable you to create subdirectories in a matter of minutes, so your new WordPress install should be up and running quickly. In this article, we’ll talk a bit more about subdirectories and when to use them. Then we’ll teach you how to create one and set up WordPress on it. Let’s get started!
What Subdirectories Are (And When You Should Use Them)
A subdirectory is simply another name for a nested folder. For example, if you like to save photos of puppies to your Image folder, you could set up a subdirectory called Dogs inside. The same process applies to WordPress websites.
Technically, nothing is stopping you from using the same WordPress installation to run a website that includes a blog. However, it’s often simpler to use subdirectories to set up different installations when you’re running a massive operation. Here are some other examples of cases where using subdirectories makes sense:
- You want to run an online store alongside your website. It’s often cleaner to set up a WooCommerce install (or whatever e-commerce plugin you use) in its own subdirectory, to avoid confusion.
- For multilingual websites. If you want to display your site in multiple languages, it makes sense to create subdirectories for each of them.
- When you need to use two different Content Management Systems (CMS). For example, if you want to run a website on WordPress, but use Magento for your online store, subdirectories are your friends.
- As a testing environment. Subdirectories enable you to set up WordPress installations you can use as staging sites using the same domain.
It’s essential to understand the difference between two similar terms: subdirectories and subdomains. They’re not the same, even if they work similarly. You can use subdomains for every scenario we described earlier, but subdirectories are a better option.
The decisive factor here is that search engines recognize subdomains as individual websites. This means they don’t carry over the benefits from your Search Engine Optimization (SEO) work on your original domain. Subdirectories, on the other hand, do benefit from your SEO efforts.
Given this, we wouldn’t recommend using subdomains unless you don’t want those websites to rank in search engines. Testing or staging sites, for example, are situations where SEO doesn’t really matter, so you can use either subdomains or subdirectories. The same goes if you want to use subdomains to run individual websites, which isn’t advisable, considering how cheap it is to buy unique domains.
How to Install WordPress Within a Subdirectory via cPanel (In 2 Steps)
You’ll be pleased to know that installing WordPress to a subdirectory is a simple process. We’ll be showing you how to do this using cPanel, but the steps will be similar regardless of your host’s management panel.
Step #1: Create a Subdirectory
Creating a subdirectory is a fancy way of saying “set up a new folder”, which is something your cPanel enables you to do in a few minutes. First off, log into your cPanel, locate the File Manager button, then click on it:
Once you’re in, you should see at least one folder that contains your current WordPress installation. You’re going to look for the + Folder button now and click on it, then choose a name for your subdirectory:
Whichever name you choose will become part of your subdirectory’s URL, so keep that in mind. Leave the new folder alone for now and return to your cPanel’s main screen.
Step #2: Install WordPress in Your New Subdirectory
Many hosts now include a one-click setup options for popular CMSs, such as WordPress. There are many different installers available, although in our example, we’re using the Softaculous App Installer. In any case, you’ll need to look for the WordPress icon, and click on it:
On the next screen, click on the Install tab, and you’ll see a handful of fields you need to fill out before the installation begins. Pay particular attention to the top of the screen, which enables you to choose a name for your site and select where to install it:
You’ll need to select the primary domain for your new WordPress install (if you have more than one), then type the name of your new directory in the In Directory field. The rest of the settings are simple enough. You’ll have to choose an admin username and password, a language for your site, and more. When you’re done, click Install at the bottom of the screen.
When the process is over, you’ll be able to access your new WordPress setup by going to yourwebsite.com/yoursubdirectory.
Now you can access your dashboard and customize your website as you would in any other case. Any changes you make here won’t affect your primary WordPress setup, so go crazy!
How to Install WordPress Within a Subdirectory Manually Via FTP
If your web host doesn’t provide you with access to a full-fledged control panel, you can always set up a subdirectory and install WordPress via File Transfer Protocol (FTP). You’ll need an FTP client, such as FileZilla, and a set of credentials that should’ve been provided via email when you signed up with your web host. You may also need to bone up on your FTP skills before tacking this method.
First, log into your website via FTP and navigate to the directory including your WordPress root folder (usually named public_html). Now, right-click below that directory and choose the option reading Create directory:
The FTP client will ask you to set a name for your new directory before creating it. Keep in mind – not all web hosts enable you to create subdirectories. If you run into an error at this stage, you probably don’t have the necessary permissions to do so. In this case, you’ll either need to use the cPanel method exclusively, or contact your host for advice.
On the other hand, if you didn’t run into any errors, you can go ahead and install WordPress. First, you’ll need to download the latest version of the CMS from its home page:
Once complete, unpack the contents of the zipped file within a new directory. That way, they won’t get mixed up with any other files:
Now return to your FTP client and navigate to within the folder where you just placed all those files on the left hand side. Next, access your new subdirectory on the right side of the client. Select all of the WordPress files within your local folder and drag them to the subdirectory:
This will prompt your FTP client to upload copies of all those files to your server, within the subdirectory. Depending on your internet speed, this process might take a while, so sit back.
When the transfers are done, you’ll need to set up a new database for your website before running the WordPress installer script. When complete, go to yourwebsite.com/yoursubdirectory/, which will execute the WordPress installer. During the process, you’ll need to enter your database’s details, including its name, admin username, and password. Without that information, the installation won’t be able to continue.
In most cases, you’ll want to use subdirectories over subdomains. They’re better from an SEO perspective, since they’re recognized as part of your website, and in our opinion they just look better. Plus, creating subdirectories is simple, and you can have as many as you want. For example, if you need to set up a multilingual website, you can quickly create a handful of subdirectories and use one for each language.
There are two ways you can go about setting up WordPress on a subdirectory, and they’re both very straightforward:
- Use your cPanel to install WordPress.
- Set up the platform manually via FTP.
Do you have any questions about how to install WordPress within a subdirectory? Let’s talk about them in the comments section below!
Article thumbnail image by Rvector / shutterstock.com.