How to Easily Install WordPress in a Subdirectory

Would you like to install WordPress in a subdirectory? If so, then you will have a very easy time running multiple WordPress instances under the same domain name. This can all be accomplished without affecting the actual domain you are creating the subdirectory in. This is used for creating multiple websites on the same domain name, which has many benefits.

For starters, by using an existing domain name you are not exactly starting from scratch when you create this new subdirectory. Keep in mind that a subdirectory is different from a subdomain. This means it has its own set of benefits from creating a new website, like SEO. A subdirectory will benefit from the domain name and will rank higher than normal. Today I will demonstrate how to install WordPress in a subdirectory.

Why Install WordPress in a Subdirectory

As I said before it allows you to run multiple WordPress instances on a single domain name. This in itself will save you a few bucks from registering another domain name through your web hosting provider. That might sound great as a short-term benefit, but the major one is the long-term SEO benefits. Ranking higher on search engines like Google and Bing will help your website grow and increase your web traffic. The more traffic you get, the better the chances that you will build a strong community.

The obvious advantage of having a higher amount of web traffic is ad revenue. The Internet is free thanks to advertisements, and it is one of the main sources of income website developers will make a profit off. The more popular the website, the more advertisement opportunities you will have, but remember not to ruin the visitor’s experience by placing too many ads or slowing down your website’s page load time.

How to Easily Install WordPress in a Subdirectory

Today I will demonstrate how to install WordPress in a subdirectory. There are no additional plugins needed, but you will need access to your websites cPanel, which is provided by your web host. Since you will be creating a subdirectory in an existing domain name that is in use, you should create a backup of your website before continuing. This will ensure that if something goes wrong, you will be able to revert to when the previous version when everything was working.

Head over to your cPanel provided by your web host. Click on the File Manager option.

Click on the File Manager option.

Your WordPress files should be located in the public_html directory. You will want to create a new subdirectory in this section. Add a new directory by creating a new folder. Make sure you do not name the folder something that is already in use. The folder name is also what your visitors will type into the URL to find it, so make sure it is appropriately named for them. This will cause errors, and it is best if avoided. Also never leave a space in any of your files names. Fill in any spaces with a hyphen. For example, New Directory should be New-Directory.

Create a new directory

The newly created folder is now empty. You now need to install WordPress in the folder. Visit the download page of WordPress.org and download the WordPress files. Begin the process by clicking on the “Download WordPress 4.8.3” button. The file you downloaded will be a zipped version.

Click on the "Download WordPress 4.8.3" button.

Upload the zipped WordPress-4.8.3 folder that you just downloaded into your newly create subdirectory folder. Once it is in the newly created directory, you will need to unzip the file by clicking on the extract button. Once it is done, you should see a WordPress folder appear. You can now delete the zipped file.

Click on the extract button.

You now have a slight problem with having the WordPress folder where it is. Instead of going to:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]www.ggexample.com/New-Directory[/ht_message]

Your visitors will have to go to:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]www.ggexample.com/New-Directory/WordPress[/ht_message]

To fix this go inside the WordPress folder and highlight all of the content. Click on the move button and move all of the files directly into the New-Directory folder. You can now delete the WordPress folder.

Move all of the files into the New-Directory folder.

You now have two things left to do. Create a new database for your subdirectory and go through the installation process for WordPress. Let’s focus on the Database portion first. Go back to the main cPanel and click on the MySQL Databases option.

click on the MySQL Databases option

On this page, you need to create a new database, username, password, and add the necessary privileges to the new user you created. Simply go through the page and insert the appropriate information, but make sure to write down the username and password you create. Make sure you click on the respective buttons to save your work in each section.

Go through the WordPress installation process.

It’s now time to install WordPress in the subdirectory. Go to:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]www.ggexample.com/New-Directory[/ht_message]

In the above URL, New-Directory is the name of the subdirectory you placed the WordPress folder in. Once you load the page, you will be inside the WordPress installation wizard. Follow the instructions and insert the appropriate information in the appropriate fields. Once you are done entering the information, you will be prompted to install WordPress.

It is possible you already have WordPress installed in the root directory. This will cause a 404 error but can be easily fixed. Copy and paste the following code into the .htacess file:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# BEGIN WordPress

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[/ht_message]

Congratulations, your subdirectory now has WordPress installed. Remember you can always change the New-Directory name to whatever you want it to be and the name should be catchy. It can be changed as often as you want.

Use Your New Subdirectory Well

Your subdirectory is a brand new WordPress instance that you can take advantage of. Start treating it like a sister website of your existing one. Keep in mind you can include links and advertisements to it on your original website to speed up the traffic and to get it discovered fast. You will need to take the time to design it and add content to it, but I’m sure you already knew that.

Some useful tips for any new website are to make sure you install a theme that fits your website and to include the necessary plugins needed. These may include things like security and SEO plugins but never underestimate their value. Plugins are the way you add functionality to your website, so pick what you need.

Why did you take the time to create a subdirectory with WordPress installed? Do you think having a subdirectory is more convenient than creating a new domain name?

8 thoughts on “How to Easily Install WordPress in a Subdirectory”

  1. I have a website on a server, I have pointed the DNS to his ip, I also have another server , on it I have a wordpress that I will use it that way “mysite.com/ 1 blog “, I will use as a subdirectory not a subdomain, I want to know if it is possible, adjust the dns to show a main site in one server, and the blog in another, already tried to put two ips in the dns did not work, gave conflict , I tried to use the page rules of the Cloudflare pointing the blog to ip, without success, anyway how should I point the dns?

    1. Michael Phillips

      I’m not really sure what you’re trying to accomplish. You want a blog running on server B to show up on server A as serverA.com/serverB?

      If so, I’m afraid you can’t do that. The DNS record for a domain can point to multiple IP addresses, but those IP addresses are typically mirrored servers. In other words, the content is the same at each IP. That’s how some kinds of load balancing work.

      There’s no DNS setting you can make to have the content from a separate server show up as a subdirectory.

  2. # BEGIN WordPress

    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

    wehere should i add this code in root folder or subdirectory folder?

  3. Sir, what will happen if I do not create database for sub directory , just install wordpress and use it like a main website. ?

  4. Great article. If i create a subdirectory, what happens to the main website speed.? Now my main Web site has 16plugins. I want to create a subdirectory like ***.com/customercare, and use is as some plugs like mail chimp, abandoned cart, shipping information, yoest plugins to the subdirectory. Is it possible? If I use seo plugin to subdirectory, is it support to the main site? Thanks for the help

  5. Thank you for this guide.

    We are planning to have subdirectories on our next website. This guide really cleared the air.

    One question,

    Is there a limited to how many subdirectories a WordPress website can have?

    1. Technically no. But you want to be careful about making too many as it will take quite a bit of space on your hosting account. Not to mention how it could impact performance if several of your WordPress subdirectories are driving tons of traffic.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.