Awwwards Nominee Awwwards Nominee

Installing WordPress within a Subdirectory – The 5 Step Process

by : rajkishore Category : UX/UI,WordPress Date :

Are you forward to install WordPress in a subdirectory? The process allows you to run several WordPress instances under one domain/subdomain name. This tutorial will help you know the way to install WordPress in a subdirectory sans any effect on the parent domain name.

Generally, WordPress website is preferred on its own domain name. However, there are times you would want to create additional websites too on the same domain name. Here, you need to do any of the following:

  • Installing WordPress in a subdomain (newebsite.example.com)
  • As a subdirectory (example.com/newwebsite/)

When it comes to SEO, sub-directories get the added advantage from the domain authority of root domain which makes them rank higher. A WordPress multi-site network can be installed to create separate WordPress sites in a subdomain as well as subdirectory without any hassles.

In case, you are interested in managing both sites separately, simply install different WordPress instances.

Here’s how you can install WordPress in a subdirectory:

#1. Create a Subdirectory under The Root Domain Name

Step 1 – Start by creating a subdirectory or folder under your root domain name. This is precisely where you will install WordPress files.

Step 2 – Now connect to WordPress hosting account. This is done by using File Manager or FTP client in cPanel.

Step 3 – After getting connected, visit your website’s root folder (the /public_html/ folder). In case, WordPress is already installed in the root folder, you can see all WordPress files and folders there.

Step 4 – Right-click and select ‘Create a new directory’ from the menu.

Be watchful when selecting the subdirectory name as it will form a part of URL of the new WordPress site and what users will type in their browsers to reach your site.

For instance, if you wish to name the directory ‘health-guides’ then address for your WordPress website need to be:
http://example.com/health-guides/

#2. Upload WordPress Files

The subdirectory you recently created is empty at present. So change this status via uploading WordPress files.

Step 1 – Start by visiting the website ‘WordPress.org’. Now click on the button ‘download’. The browser will download the zip file comprising of the latest WordPress software to your PC.

Step 2 – Select and extract the file once it is downloaded. If you are a Mac user, simply double click the file to extract it. For Windows, right click and select ‘Extract All’. Once you extract the zip file, a ‘wordpress’ folder will be visible. It contains all WordPress files.

Step 3 – It is time to upload these files to your new subdirectory. Now connect to your website by using an FTP client. Visit subdirectory that you created in the first step. Visit the ‘WordPress Folder’ that you extracted. This folder is present in your FTP client’s local files panel.

Step 4 – Now select all files in the WordPress folder. Simply upload them to your new subdirectory.

#3. Create New Database

All of the content is stored in a database by WordPress. So when a new WordPress site is installed in a subdirectory, it is crucial to develop a new database to use.

Step 1 – Start by logging in to your WordPress hosting account’s cPanel dashboard. Now click on ‘MySQL Databases’ which is visible under the section ‘databases’.

Step 2 – The next screen arrives and it is time for you to assign a name for your new database. Now click on the button ‘Create Database’ to continue.

Step 3 – The cPanel dashboard creates new MySQL database. Create a username for MySQL to be able to use this database. It is time to scroll down to the section ‘MySQL Users’ and assign a new username and password. Continue by clicking on the button ‘Create User’.

Step 4 – The next step is to allow privileges to the freshly created user on the database created earlier. Start scrolling down to the section ‘Add user to database’. Select MySQL username.

Step 5 – Now select the database, you created recently. To continue, click on the button ‘Add’. Full privileges will be granted to the MySQL user by Cpanel on your freshly created database.

#4. Install WordPress

It is time to install WordPress. All you need to do is visit the directory you created earlier in a web browser.

Step 1 – Type the following URL:
http://example.com/your-subdirectory-name/
The step will display installation wizard WordPress. Select the language for WordPress website. Now click on the button ‘continue’.

Step 2 – Now you need to provide the following details:

  1. The database name of WordPress
  2. Username of database name
  3. Password
  4. Database host

Step 3 – Click on the button ‘submit’ after entering all of the above-listed database details.
The action will prompt WordPress to connect to your database. A success message like the following will be displayed:
“Alright! You’ve made it to this part of the installation. WordPress can now communicate with your database. If you are ready, time now to…
ClickRun to install’.”

Step 4 – Follow the message instruction and click on the button ‘Run the install’ to continue.
The next screen will appear where you will be asked to provide a title for your website. Here, you would also need to provide choose the following details:

  • Admin username
  • Password
  • Email address

Step 5 –  After entering your website details, click on ‘Run install’ button to continue.
Now WordPress will set up your website and display a success message like this:
“Success!
WordPress has been installed. Thank you and enjoy!”

Step 6 – Simply go ahead and login to your new WordPress website which has been installed in the subdirectory.

#5. Fixing Permalinks

Expect .htaccess files of your subdirectory to cause some conflict if there is a separate WordPress install within the root directory. The conflict will lead to ‘404’ errors on the website.

The Solution – Most experienced freelance web developers and professionals would suggest you to edit the .htaccess file present within subdirectory WordPress install.

Step 1 – You need to replace the code in your .htaccess file with the code mentioned below:

1. # BEGIN WordPress
2. <IfModulemod_rewrite.c>
3. RewriteEngine On
4. RewriteBase /your-subdirectory/
5. RewriteRule ^index\.php$ – [L]
6. RewriteCond %{REQUEST_FILENAME} !-f
7. RewriteCond %{REQUEST_FILENAME} !-d
8. RewriteRule. /your-subdirectory/index.php [L]
9. </IfModule>
10. # END WordPress

Step 2 –  Make sure you replace /your-subdirectory/ with the subdirectory name of yours.

Hope the above tutorial helped you to install WordPress in a subdirectory. Good Luck!

Raj Kishore About Raj Kishore A digital marketing consultant at VOCSO. I've been working in digital marketing since 2010 and I am an expert at generating leads online via SEO, Paid Marketing, Social Media Marketing, Email Marketing, Site/Landing Page Testing and Optimization, and Display and Remarketing.


Further Reading...

We use cookies to give you the best online experience. By using our website you agree to use of cookies in accordance with VOCSO cookie policy. I Accept Cookies