How To Install WordPress In A Subdirectory – A Quick Guide


Bart Keating


2019 March 27th


When you want to run more than one instance of WordPress on a single domain, it’s important to know how to install WordPress in a subdirectory.

Controlling your WordPress install directory can also be helpful for managing several WordPress sites on a single web server, or even if you simply don’t want to have WordPress installed in your site’s root folder.

These are the steps to download WordPress in subdirectory:

  • Step 1 - Create a subdirectory in your root folder
  • Step 2 - Import WordPress to the subdirectory
  • Step 3 - Create a new WordPress database
  • Step 4 - Complete WordPress installation
  • Step 5 - Fix permalinks in ‘.htaccess’

Subdirectory vs. Subdomain

Before you decide to install WordPress in a subdirectory, it is important to consider whether this is a better choice for your site than to install WordPress in a subdomain. Both allow you to create multiple WordPress sites on the same domain, but with several important differences.

First, the URL of a subdirectory installation will be different from a WordPress subdomain installation. If you install WordPress on a subdirectory the URL will look like ‘’. If you install WordPress on a subdomain, the URL will look like ‘’.

WordPress in Subdirectory Subdomain Setup

In addition, there are differences in how search engines treat subdirectories and subdomains.

In general, subdirectories are better for SEO since WordPress in a subdirectory benefits from the web traffic to the root website.

When you install WordPress on a subdomain, traffic to the root site does not count towards the subdomain site’s SEO in most cases.

1. Create a Subdirectory in Your Root Folder

The first step to install WordPress in a subdirectory is to make a new WordPress install directory inside your root folder.

To do this, you’ll need to access your site’s file structure through your host’s cPanel or by connecting to your host via an FTP client. Once you are connected, find your website's root folder, which is usually the folder named ‘/public_html/’. You should see any existing WordPress files in this folder if you already have WordPress installed.

WordPress in Subdirectory Create Subdirectory cPanel

Create a new folder in your root directory and give it a name. Note that the name you give to the subdirectory will become a piece of your website’s URL, such that visitors will need to navigate to ‘’, so it is important to name this folder wisely.

2. Import WordPress to the Subdirectory

The next step to put WordPress in a subdirectory is to download the latest version of WordPress and to copy those files into the folder you just created.

Navigate to to download the latest version of WordPress and save the zipped folder to your hard drive in an easily accessible location. Then find the zipped folder in your computer’s file browser and unzip it.

WordPress in Subdirectory WordPress Download

Now, login to your site using an FTP software client if you didn’t in the previous step. The login information to access your site can be found by logging into your hosting account.

In your FTP client, navigate to the subdirectory you made earlier and upload the unzipped files from the folder you downloaded from to your site.

3. Create a New WordPress Database

Now you to make an additional database that your WordPress installation can use for storing content. Log back into your host and open the cPanel, then find the ‘Databases’ section. Click on ‘MySQL Databases’ to open the new database wizard, give your database a name, and choose ‘Create Database’ to continue.

You will then need to create a new username and password for the administrator of this database. Be sure to keep track of this username and password, as you will need it to finish installing WordPress in a subdirectory and for any future database updates. Navigate to ‘MySQL Users’ and click ‘Create a New User’ to enter the new login information.

The last thing you must do is connect this new user to your new MySQL database.

Click ‘Add User to Database’ and choose the user and database names you just created from the two drop-down menus.

Click the ‘Add’ button to give your user privileges to edit the MySQL database and continue.

4. Complete WordPress Installation

Now that you have everything in place for the WordPress install directory, it’s time to finish the WordPress installation. In your browser,

Visit the URL of the subdirectory folder you made earlier, ‘’, in your web browser to access the WordPress installer.

After selecting a language for the installation, the wizard will prompt you to enter the username and password for the MySQL database user you just created. Enter ‘localhost’ for the ‘Database Host’ and ‘wp_’ for the ‘Table Prefix’. When ready, click ‘Submit’ to allow WordPress to access your MySQL database.

If the database login is successful, you will get a message prompting you to install WordPress. Click ‘Run the install’ and enter your new WordPress site’s name on the following screen. You’ll also need to create a username and password for your site, which will be your login credentials to access the WordPress administration panel, as well as enter your email address. Click ‘Install WordPress’ to continue.

WordPress in Subdirectory WordPress Installation

At this point, WordPress will go ahead with the installation and display a message to indicate it when it has finished successfully. Congratulations! You now have a copy of WordPress in a subdirectory of your site.

5. Fix Permalinks in ‘.htaccess’

If the main directory of your site is also running WordPress, such that you have a copy of WordPress installed in your root directory as well as the subdirectory, you’re not quite done yet. The ‘.htaccess’ file of the WordPress subdirectory installation can conflict with that in the root directory and cause a 404 error on your WordPress site.

To solve this, you need to update the permalinks in the ‘.htaccess’ file in your copy of WordPress in a subdirectory. Download the ‘.htaccess’ file with an FTP client or access the file editor in your host’s cPanel, and replace the contents of the file with this code:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /your-subdirectory/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /your-subdirectory/index.php [L]
# END WordPress

Don’t forget to replace ‘your-subdirectory’ with the actual name of the subdirectory you created. When done, re-upload the new ‘.htaccess’ file or save the edited copy to finish installing WordPress in a subdirectory.

Final Thoughts

Installing WordPress in a subdirectory is an excellent way to create multiple sites with separate management, themes, and plugins all under the same domain. While it is worth considering if a subdomain would better suit your needs, a subdirectory installation receives SEO benefits from being below the root site in the folder and URL structure.

Did this guide help you install WordPress in a subdirectory? Let me know in the comments below!

Leave a Comment

* your email will not be displayed