Do you want to install a WordPress blog on the website subdirectory on CloudPanel?
Companies, Online services, freelancers, and Resume CV websites install their blogs on subdirectories like website.com/blog. It helps them to display the main interactive HTML web pages on the homepage and keep a good blog on the subdirectory.
In this article, we will show you how to install WordPress on the CloudPanel site subdirectory.
Why do you have to install WordPress on the Website subdirectory?
If you have a company or freelance website, your front page needs to be an interactive and informative one, then you have to use HTML pages. Because you can design and add information whatever you want in HTML pages and easily hosted 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 on 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.
Then navigate to sites File Manager. Delete the “index.php” file and create a folder named “blog”.
Download WordPress software from the official site. Extract the zip folder and add the WordPress files inside /blog directory.
In the Database section, create a database for your WordPress blog.
Now navigate to the subdirectory and install WordPress.
After you log into the WordPress dashboard, you will find out some plugin setting pages broken.
It happened because you have to add additional settings like adding the following command in vhost.
Code:-
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_pass 127.0.0.1:{{php_fpm_port}}; 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 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 htaccess to nginx converter. Then add the code in Vhost tab.
That’s all. Now you can check your blog. Everything will work as normal.
We hope this article helped you to learn how to install WordPress On 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 for how to install CloudPanel on Vultr hosting.