Today in this blog post, I am going to show you how to install a WordPress application on sub-directory(folder) on Cloudways. Cloudways is extremely easy to use cloud agnostic platform to deploy, monitor and manage high-performance web applications. We currently support Amazon (AWS), Google Compute Engine, DigitalOcean, Linode and Vultr at target clouds and WordPress, Joomla, Drupal, Magento, Prestashop, MediaWiki, Moodle, PHP Stack … as deployable applications.
If you are a Cloudways customer you will probably know that Cloudways won’t allow you to place apps under subdirectories. Since Cloudways offers managed app hosting, it wouldn’t be possible to reconcile managing these apps and placing them inside the folders of other apps.
This tutorial is for those who already know how to install a WordPress application on Cloudways but don’t know how to install on a subfolder like http://yourdomain.com/blog where the /blog is a different directory having a separate WordPress application.
In this guide, I will show you how to install WordPress into subdirectory at Cloudways.
Step 1: Login in your Server via SSH
The very first is to login in your account is login in the server via SSH if you don’t know how to login in your server via SSH simply refer to the official Cloudways guide here:
Step 2: Goto your Application’s Webroot
After logging into SSH, navigate to main sites public_html directory. Here wshqpdcabz is my main WordPress app. you can use the command below to go in your site’s public_html folder
Remember to change wshqpdcabz with your app folder name.
Step 3: Create a Folder
Now after being in the public_html folder of your main site, create your folder for subdirectory WordPress let’s name it blog. as the site URL will be https://example.com/blog in my example, use the command below to create the folder and then navigate into it
mkdir blog && cd blog
Step 4: Install WordPress
Now we will install a fresh WordPress Application in this blog folder/directory.
I am going to use WP-CLI to download WordPress Use the command below to install WordPress
wp core download
The above command will install the WordPress files in the blog folder
Now simply visit the blog URL i.e. http://yourdomain.com/blog you will be taken to WordPress installation screen as shown below:
You will notice that it asks for the following details :
- Database name
- Database username
- Database password
- Database host
- Table prefix
Kindly note that since Cloudways don’t allow two databases for one application. So I am gonna need a new one for that I am going Install a Custom PHP App at Cloudways and grab Database name, username and password for your blog site. You can simply refer to the official guide of Cloudways on how you can add an existing app on the same server once you have added it access the PHP application.
Now as mentioned earlier grab the database name, username and password.
Go back to your installation URL and proceed, you will be prompted to the installation window as below:
After filling out the details, click on the submit button, then you will be asked to name your site and set login details.
Once you have filled out the details click on install, after the installation is finished then visit your site URL.
Hurray! now you have learned how to install WordPress in a subdirectory on Cloudways, Let me know in the comment section about what you think or for any other queries.