Share this article
Get the week's best marketing content
subdomain will be treated as a separate website ,while subdirectory will be treated similar to the root domain.
Subdirectory is an important part of SEO, having WordPress installed in the subdirectory helps you to use many WordPress instances, using the same domain.
However, so is the subdomain. So which one is better? How can you create a subdirectory website and maximize its performance?
This article aims to provide you with instructions on how to create a subdirectory website, as well as how to install WordPress in that subdirectory. Now let’s begin.
How to install WordPress in the subdirectory
Compared to a subdomain, a subdirectory will have the upper hand if your domain has a high reputation and high traffic. Since subdomain will be treated as a separate website, while subdirectory will be treated similarly to the root domain.
Install WordPress in Subdirectory – Requirements
Installing WordPress in a subdirectory does not have any specific conditions. If you have an existing WordPress website on your main domain, then you can proceed without any issues.
On the other hand, if your current website is static and not WordPress based, you may need to check with your hosting provider, to see if they support WordPress or not. If they don’t, you might have to change your hosting provider.
If you are considering changing your hosting company, some of our recommendations include: Bluehost, SiteGround, WP Engine, DreamHost, or Kinsta, all of which are well-known and have been providing hosting services for millions of websites around the world.
Now that you have a suitable hosting provider, let’s begin the process.
1. Create a subdirectory website
Here’s how to create a subdirectory website:
For starters, create a subdirectory or folder within the main website where you will add the WordPress files.
Login and connect your WordPress hosting account using File Manager in the cPanel or an FTP client.
After that, navigate your website’s root folder, which is the /public_html/ folder by default.
If you have an existing WordPress installation in the root folder, you should see the WordPress folders and files.
To create a new subdirectory, just right-click and choose “Create new directory”, then name your subdirectory. However, do this with caution, since this will be the part that your users see and type in to search for your website.
2. Upload your WordPress files
Currently, your subdirectory is still empty, you will need to upload your WordPress files. Start by downloading WordPress on WordPress.org.
Then you will have to extract the file by right-clicking the file and choose ‘Extract All’. You should see the ‘WordPress’ folder that has all the files.
Next, Go back to the subdirectory that you just created, choose all the files in the WordPress folder on your local files and upload to the subdirectory
3. Create New Database
In order to use the newly created WordPress site in your subdirectory, you will have to create a new database. You can do this by firstly login to your WordPress hosting account and go to cPanel. Find the ‘Databases’ section and choose ‘MySQL Databases’.
Next, name your new database, then choose ‘Create Database’, then go back to the Databases section.
Set the username and password for the new database in the ‘MySQL Users’ section. Then choose ‘Create User’.
In the ‘Add user to database’ section below. Choose your SQL username and your new database. Then click on ‘Add’ to allow this new user permission to work on the new database.
4. Install WordPress
All the initial steps have been completed, you can now proceed to install WordPress. The process is quite simple and straightforward.
Now what you have to do is open the directory site that you just created using your web browser. You can access to this page by typing this URL: http://your-domain/your-subdirectory-name/
Since you haven’t set up anything here, you should be brought to the WordPress installation screen. Select your language and choose ‘Continue’.
Next, enter your WordPress database name, your username and password, as well as your database host, then choose ‘Submit’ to proceed.
If everything is correct, you should receive a successful installation message. Choose ‘Run the install’ to proceed.
Entering the information in the suitable fields, includes your website title, admin username, password, and your email address.
Once everything is finished, click ‘Run Install’ to begin the procedure. Depending on many factors, it might take some time to set up, so please be patient and wait until the process is finished.
Once it is done, you will receive a success message as a confirmation. Now you can login to your new WordPress website in the subdirectory
5. Fix the Permalinks
After installing WordPress in your subdirectory, some of you may experience 404 errors on the site. This is caused by the ‘.htaccess’ files, when you already have an independent WordPress installed in the root directory
Fixing this should be easy. All you have to do edit the said file, replacing the code in 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]
</IfModule>
And you should be good to go.
Remember to change the /your-subdirectory/ to the name of your subdirectory. Or else, it will not work.
Conclusion
We hope that you find our article useful. This article’s aim is to help those who are new to WordPress and website designing, providing instructions on how to create a subdirectory website, as well as how to install WordPress in that subdirectory. This will help you to perform better, in terms of SEO marketing.
For now, thank you so much for reading. We hope you have a great day!