In this tutorial we will be discussing how to install WordPress in a subdirectory in cPanel. We will be installing WordPress in cPanel in four easy basic steps. Which are:
- Create Database
- Upload WordPress
- Edit WPConfig file
- Install WordPress
How to install WordPress in a subdirectory: The basic steps
Am going to assume that you already have a domain name and have paid for hosting as well. I also assume that you already have your cPanel login details with you and your internet browser is opened down.
STEP 1: HOW TO INSTALL WORDPRESS IN A SUBDIRECTORY
- To execute the first step on how to install WordPress in a subdirectory in cPanel, login in to your cPanel with your cPanel user name and password by typing for example, “https://yourdomainname.com/cPanel as shown in the image below:
- You should see a screen like the one shown below- your cPanel dashboard
- Scroll down and search for MySQL Database. Click on it. See image below.
- Now you will be directed to “Create New Database” window
- As shown in “1” in the image above, enter the name you want to use for your new database. For example, you can type in “wordpresstutorial”
- Click “Create Database”
- After you click on “Create Database” you will be taken to the window below. Click on “Go Back”
- Now copy the database “educraftworld_wordpresstutorial” to a safe place. You can open notepad on your computer and paste it there. You will be needing it later on. Click on go back.
- Next, you need to add a username and password for the database.
- Simply scroll down to the ‘MySQL Users’ section and provide a new username and password. Click on ‘Create User’ button when you are done to continue. See image below:
- Enter username
- Enter password
- Enter same password
- Click on “Create User”
- Make sure your username and password are saved in the notepad opened previously.
- You should see the window shown on the image below. Click on “Go Back”
- The next thing you need to do is grant your newly created user privileges to work on the database you created earlier.
- Now scroll down to ‘Add user to database’ section.
- Select your MySQL username and then select your newly created database from the drop down list and click on “Add”, as shown in the image below:
- Once you click on “Add”, you will be taken to the “Manage User Privileges” window. Check “All Privileges”. See image below for more explanation.
- Click on “Make Changes” as shown below:
- cPanel will now grant the MySQL user full privileges on your newly created database.
- NOTE: A successful message will be displayed to confirm you have granted the privileges.
- That’s the end of STEP 1. Now lets move to STEP 2.
STEP 2: HOW TO INSTALL WORDPRESS IN A SUBDIRECTORY
- To execute the second step on how to install WordPress in a subdirectory in cPanel, on your internet browser search bar, type “wordpress.org” and press the enter button. You should have a window like the one shown below:
- Scroll down. Under Get Started with WordPress, click on “Get WordPress” to download WordPress.
- You might be directed to another window like the one below, just click on “download and install”
- Now you will be directed to WordPress main download page as shown below, click on “Download WordPress 5.7.2”. Save and download WordPress to your download folder on your computer . This should be in a Zip file.
- Go back to your cPanel and search for File Manager. Click on File Manager.
- You will be directed to the File Manager Window as shown below. Click on public_html
- Click on folder and type in your sub-directory name as the name of the folder.
- Type in the name of the sub-directory as shown below. In this example am using “wordpress-tutorial”. 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.
- Click on the sub-directory that you just created. In this case we created “wordpress-tutorial”. See image below:
- At this stage your sub-directory should be empty. Click on upload.
- You should have a screen as shown in the image below. Click on “Select File” to Upload your downloaded WordPress zip file. Remember the WordPress zip file you downloaded in Stage 2.
- Wait for it to upload. Once it reaches 100% it shows the size of the WordPress zip file and “complete”. Click on “Go back to “/home2/………”
- Wait for it to load. Now you should see a screen like the one below:
- Now right click on the WordPress zip file and click on extract. In the windows that show (see sample image below), click “Extract Here”.
- Wait a few seconds and you will see a window like the one below. Click on close.
- Your screen should look like the one below. Now you have two WordPress files
- Extracted WordPress file
- Zipped WordPress
- Now, double click to open the “Extracted WordPress” file and click on “Move” to move all the files in it as shown in the image below to your main subdirectory.
- Once you click on “Move”, you should see the window below. In the box, delete “/wordpress” in the link. This is to make sure you are moving the files to the right WordPress Subdirectory, in this case “/wordpress-tutorial”
- Once you’ve done the above, you should see the link as shown in the image below. Click on “Move File(s).
- Wait few seconds for the move to reflect. Now select both the WordPress folder and the WordPress zip files. Check the “Skip the trash and permanently delete files” and click on confirm.
- This stage leads us to STEP 3.
STEP 3: HOW TO INSTALL WORDPRESS IN A SUBDIRECTORY
Edit WPConfig File
To execute the third step on how to install WordPress in a subdirectory in cPanel, we need to edit the WP-Config-sample.php file
- To edit this file, right click on it and click on rename it.
- Change “wp-config-sample.php” to “wp-config.php” and click on rename.
- Now right-click on the “wp-config.php” and click on Edit. On the window that appears (see sample image below), click on Edit again as shown below:
- The window below will show up at this stage. Now it’s time to
- Replace “Database Name” with the one you created in STAGE 1
- Replace “User Name” with the one you created in STAGE 1
- Replace “Password” with the one you created in STAGE 1
- Now click on save changes at the upper right part of the screen. Then click “Close”
- This takes us to STEP 4, which is the final step.
STEP 4: HOW TO INSTALL WORDPRESS IN A SUBDIRECTORY
- To execute the fourth step on how to install WordPress in a subdirectory in cPanel, we need to install and activate WordPress in the subdirectory we created. To do that, open your internet browser, and type in https://yourwebsite/yoursubdomain . Hit the enter button on your keyboard. For example https://educraftworld.com.ng/wordpress-tutorial
- On the screen that shows up, choose the language with which you want to install WordPress and click “Continue”
- Now fill in the details for logging into your WordPress dashboard
- Site Title: Enter the title you want to give your site
- Username: Enter the username for your site
- Password: Enter the password for your site
- Your Email: Enter the default email to log into your WordPress site
- Search Engine Visibility: Check to discourage search engine from indexing your site or leave it as it is.
- Finally click on Install WordPress to complete the installation
That’s it, the most basic simple four steps on how to install WordPress in a subdirectory. Do you like this post, do share with your friends and colleagues. Someone out there may need the information in this post. Also, if you have any question about the installation, please hit me up in the comment section.
Johnson Omoregie is an SEO specialist/Website Developer/ SEO Copywriter/Content Developer. He eats and sleeps Search Engine Optimization (SEO)/Digital Marketing. And help business generate leads and conversions through Organic Traffic. He is the author of Business Profit Blueprint: Million Dollar Tips To Promote Your Business And Increase Profit.