WordPress has a multisite setup for having a network of site under single installation. This is generally not ideal scenario, as many plugins does not support multisite installation. Also you may want to have a child site for different reason. In such case, you have two options – one is to install WordPress on subdomains and the next is to install WordPress on subdirectory. In this article let us explain how to install WordPress on subdirectory.
Subdomain Vs. Subdirectory
This is always a confusing factor for many site owners. Subdomain and subdirectory are perceived in different manner.
- Subdomain example is https://subdomain.yoursite.com
- Subdirectory example is https://www.yoursite.com/subdirectory/
The most important thing is that subdomain is considered as a different site by search engines like Google. While subdirectories are part of the same parent site. But you can treat them in different manner if you would like. You can add subdomains and install WordPress through cPanel applications like Softaculous. For subdirectories, you can simply enter the directory during installation process. In this article, we will explain both cPanel and manual way of installing WordPress.
1. Install WordPress on Subdirectory From cPanel
Login to your hosting cPanel account. There are multiple one-click applications used for installing WordPress. In our case, we show using Softaculous. Click on the Softaculous application and then choose WordPress to install.
Enter the directory as option and type the name of the directory in which you want to install WordPress.
Softaculous will install WordPress on the entered directory and create necessary database table and users.
2. Manually Installing WordPress on Subdirectory
The manual process has lot of steps to follow. Learn how to install WordPress manually on main domain.
2.1. Download WordPress Files
Go to WordPress website and click on the ‘Get WordPress’ button. On the download page, click on ‘Download WordPress xxx’ button to download the latest WordPress version to your local computer.
2.2. Creating Subdirectory
You don’t need to create subdirectory when you use one click applications like Softaculous. But for manual installation, you should manually create the subdirectory under the root of your main site’s installation. Login to your hosting server using FTP and navigate to the root path of your domain. We use FileZilla for this purpose. The root of your server is generally show ‘/’. Right click and select ‘Create directory’ option.
Enter the new directory name and click OK. The new directory will appear in the root section now.
2.3. Upload WordPress Files
Next step is to upload WordPress file into the directory. First extract the downloaded zip file and unzip the content. Upload the unzipped content inside the new directory using FTP.
2.4. Create Database and User
This has three parts – create database, user and then assigning the user to the database. Go to your hosting account and navigate to ‘MySQL Databases’ available generally under ‘Databases’ section.
Enter a database name and create a new database.
Scroll down and under ‘MySQL Users’ section, enter username, password and create a username. Generally in the same section, you can select the database and username and link them.
2.5. Install WordPress
Ensure that the FTP file upload is completed. Now go to your subdirectory URL like ‘yourdomain.com/subdirectory/ in the browser. You will see that WordPress will ask you to select language for installation. Choose the language for your installation.
On the next screen, fill up you database and username details and click on ‘Submit’ button.
Click on the ‘Run the install’ button and it will take hardly a minute to complete the setup.
3. Login to Dashboard
Whether you have installed using cPanel or manual method accessing subdirectory depends upon how you want to use WordPress.
3.1. Running WordPress on Root
There are good chances that you are already running a WordPress installation on the root. In such case the subdirectory site will show 404 or 500 errors. Open your FTP client, go to the subdirectory and look for .htaccess file. Edit the file and add the below entries in your .htaccess file. Now you should be able to independently access the subdirectory site.
# Start WordPress on Directory
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 on Subdirectory
3.2. Running WordPress on Subdirectory with Main Site URL
The second possibility is that you installed WordPress on subdirectory but still wanted to access the site from the main domain URL. In such case, change the home and site URL under ‘Settings > General’ in your WordPress admin panel like below:
- WordPress Address URL: https://www.yoursitename.com/subdirectory/
- Site Address URL: https://www.yoursitename.com/
If you can’t access admin panel, then you can change the URLs in your ‘wp_options’ table from phpMyAdmin in cPanel.
Leave a Reply
Your email is safe with us.