Sep 14, 2023 Web Hosting

CloudPanel: How to Install WordPress in a Subdirectory (Easy Way)

CloudPanel Install WordPress in a SubdirectoryPin

Do you want to install a WordPress blog in the website subdirectory on CloudPanel?

Companies, online services, freelancers, and resume CV websites install their blogs in subdirectories like It helps them to display the main interactive HTML web pages on the homepage and keep a good blog in the subdirectory.

In this article, we will show you how to install WordPress in the CloudPanel site subdirectory.

Why do you have to install WordPress in the website subdirectory?

If you have a company or freelance website, your front page needs to be interactive and informative, so you have to use HTML pages. Because you can design and add whatever information you want to HTML pages and easily host them on your website hosting account.

It also increases website homepage speed and gives a good page score in the Google page speed test.

Let's take a look at how to install WordPress in the subdirectory.

Add a Site as a PHP Application

The CloudPanel does not allow users to directly install apps on a subdirectory. First, you have to create an environment to run an app.

Add your site as a PHP application. It will add a PHP/MySQL environment. So you can create and use MySQL databases.

CloudPanel add PHP sitePin

Then navigate to the site's File Manager. Delete the “index.php” file and create a folder named “blog”.

CloudPanel create subdirectoryPin

Download WordPress software from the official site. Extract the zip folder and add the WordPress files inside the /blog directory.

In the Database section, create a database for your WordPress blog.

CloudPanel create Mysql databasePin

Now navigate to the subdirectory and install WordPress.

 install WordPress manuallyPin

After you log into the WordPress dashboard, you will find some plugin settings pages broken.

CloudPanel broken WordPressPin

It happened because you had to add additional settings, like adding the following command in vhost.

CloudPanel VhostPin


location /blog/ {
try_files $uri $uri/ /blog/index.php?$args;
index index.htm index.php;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_param HTTPS "on";
fastcgi_param SERVER_PORT 443;
fastcgi_param PHP_VALUE "{{php_settings}}";

location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map)$ {
add_header Access-Control-Allow-Origin "*";
expires max;
access_log off;

Note: CloudPanel uses an Nginx server. So WordPress does not create a .htaccess file. If you want to add any .htaccess rule, you have to convert the rule to vhost code using the htaccess to nginx converter. Then add the code in the Vhost tab.

That's all. Now you can check your blog. Everything will work as normal.

We hope this article helped you learn how to install WordPress in a subdirectory in CloudPanel. You may also want to see our guide on how to move your WordPress blog to new hosting or our expert guide on how to install CloudPanel on Vultr hosting.

Share to...