[Guide] Install WordPress into Subdirectory at Cloudways



Anything is tough, till you don’t know how to crack it. :wink:

Well, installing WordPress into a Subdirectory is tricky at Cloudways. As there is no direct option where you can simply enter path /wordpress/ and press the Install button.

To Install WordPress into Subdirectory at Cloudways

  1. Login to SSH, navigate to public_html directory. Here hsaysczbmy is my main WordPress App.
    cd applications/hsaysczbmy/public_html/

  2. Now, Install WordPress
    wget http://wordpress.org/latest.zip

  3. Unzip WordPress folder, and rename subdirectory, example gulshan
    unzip latest.zip && mv wordpress gulshan

  4. Navigate to Subdirectory
    cd gulshan

  5. rename wp-config-sample.php to wp-config.php
    mv wp-config-sample.php wp-config.php

  6. Install a Custom PHP App at Cloudways, grab Database name, username and password. Wondering why? Because CW don’t allow two databases for one application.
    Click on Custom PHP Application (Sub WordPress)

    Copy Database details

  7. Edit it > Write out
    nano wp-config.php

  8. Navigate to your subdirectory, proceed to famous 5 minutes installation page.

  9. After then… get your Subdirectory ready. :smiley:

  10. Last, don’t forget to add .htaccess rules especially for subdirectory to avoid permalink conflict.
    nano .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /gulshan/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /gulshan/index.php [L]
# END WordPres

That’s all, I hope this helps.

Have any question? Please feel free to ask below. :slight_smile:


Thanks & Regards,

Migrate Heavy wp-content Folder From One Host to Another Easily
Migrate WordPress from Cloudways to Vultr with ServerPilot (In 1 hour)

I am going to give this a shot now. Thank you!


If I have an existing blog with 3k+ images and 130+ posts that has to be put in the subdirectory, will it be better to

  1. Install WP in sub directory and then use blogvault to move everything there or
  2. Create directory in public_html, upload files to directory, create db in new php app, and then edit config file details?

I am assuming 1st option is easier.

Waiting for backup to complete to try this one. I have a strict rule that I should avoid crashing my site more than once a week. Quota for this week already over. :joy:


It seems, I need to write an another tutorial. How to backup really-really large site in few second without a plugin? :smile:

Backup plugin process is slow, not sure how many hours it may take to complete.


Yes please.

I think I will reach the big size category soon. 27 drafts fully typed and ready waiting for images. Once I upload them, media will have 3k+

Site is not public yet so using jetpack for backup now. It will cause page loading speed later.


Will publish it soon, writing now. :slight_smile:


I am not sure, if Blogvault can work for subdirectory or not.

Assuming, you want to copy root WordPress site to directory. I would like to explain it step-by-step.

Step 1. Follow the above steps completely to Install a normal WordPress at Subdirectory. Don’t worry, we will change database, and wp-content in the next steps.

Step 2. Go to Main WordPress Application > MySQL manager > Export its Database

Step 3. Now, Go to Custom PHP Application > MySQL Manager > Import your downloaded Database.

Step 4. Now, we will copy wp-content directory from root to subdirectory

Step 5. Open putty

Step 6. Go to path /applications/<main wordpress folder>/public_html/
cd applications/type_here_folder_name/public_html/

Step 7. Create a ZIP file of wp-content folder, type below command to continue
zip -r wp-content.zip wp-content/

Wait till wp-content zip becomes ready.

Step 8. Navigate to subdirectory, for example subdirectory name is gulshan
cd gulshan

Step 9. Download wp-content.zip file into subdirectory
wget https://main-wordpress.com/wp-content.zip

Step 10. Before, unzipping wp-content, it’s important to remove existing one wp-content folder.
rm -rf /wp-content/

Step 11. Now unzip wp-content.zip folder
unzip wp-content.zip

Now, Your root wp-content folder has been copied to subdirectory.

Step 12. Update Site URL and Home URL in wp-config.php file directly by pasting below code


A search and replace will be required.


Excellent guide @GulshanKumar appreciates your efforts. :slight_smile:

@Wands_Blog Gulshan is a champ :wink:


Thank you so much. :slight_smile: