Skip to content
Technology for businesses since 2008

Help center · WordPress

How to install WordPress on a subdomain or subfolder with cPanel

To install WordPress on a subdomain, create the subdomain in cPanel (for example, blog.yourdomain.com) and, in Softaculous, choose that subdomain as the installation address, leaving the directory field empty. To install it in a subfolder, choose the main domain and fill in the directory field with the folder name (for example, blog), which creates the site at yourdomain.com/blog.

This article is for anyone who already has a site and wants to open a second WordPress site alongside it: a blog, a store, a testing environment or another project’s site. It shows the difference between the two options, the step-by-step process for both, and the precautions to take with your main WordPress site and with the .htaccess file.

Subdomain or subfolder: which one to choose?

With both options, the new WordPress site is independent: it has its own files, database, users, themes and plugins. The difference lies in the address and in how cPanel organizes the folders.

Subdomain Subfolder
Address blog.yourdomain.com yourdomain.com/blog
Folder on the server Its own folder, defined when the subdomain is created A folder inside the main site’s folder
Extra step in cPanel Create the subdomain first None
SSL certificate Must cover the subdomain Uses the main domain’s certificate
Effect of the main site’s .htaccess Can be affected, if the folder sits inside the main site’s folder Can be affected, since it sits inside the main site’s folder
Good for Testing environment, store or system separate from the brand Blog or section that is part of the same site

To keep environments well separated, a subdomain is usually the cleanest choice. If the content is part of the same site, use a subfolder.

Before you begin

  1. Back up your main site. See how to back up WordPress.
  2. Choose the name for the subdomain or folder, without accents or spaces.
  3. If the main site already has a page with the subfolder’s name (for example, /blog), choose a different name to avoid address conflicts.

How to install WordPress on a subdomain

Step 1: create the subdomain in cPanel

  1. In cPanel, open Domains (or Subdomains, depending on your panel version).
  2. Create the subdomain, for example blog, choosing the main domain from the list.
  3. Check the document root, the folder where the subdomain’s files will be stored, and note its name. The panel suggests a value, and you can adjust it.

The full step-by-step guide is in how to create a subdomain in cPanel.

Step 2: install through Softaculous

  1. In cPanel, open the Softaculous Apps Installer and click WordPress.
  2. Click Install Now.
  3. In the protocol field, choose https:// only if the subdomain already has an SSL certificate.
  4. In the domain field, choose blog.yourdomain.com from the list.
  5. In the directory field (in some versions it appears as “In Directory” or “Installation Directory”), delete any value that is there. Softaculous may suggest a folder name, and if it stays filled in, the site goes to blog.yourdomain.com/folder instead of the root of the subdomain.
  6. Fill in the site name and the administrator username and password, using a strong password.
  7. Click Install and wait for the completion message.

Field names and the order of options vary depending on the Softaculous version. What matters is this: the chosen domain is the subdomain, and the directory is empty.

How to install WordPress in a subfolder

  1. In Softaculous, click WordPress and then Install Now.
  2. In the domain field, choose the main domain (yourdomain.com).
  3. In the directory field, type the folder name, for example blog, without slashes. The final address will be yourdomain.com/blog.
  4. Fill in the administrator details and install.

Pay attention to the directory field: if it’s left empty, Softaculous installs WordPress at the root of the domain, in the same place as the main site. It usually warns you when an installation or files already exist at the destination, but don’t rely only on that: read the address shown before confirming.

Precautions for your main WordPress site

  • Don’t install on top of an existing site. Never choose the same domain and directory as a site that already exists.
  • Each installation has its own dashboard. The new site’s dashboard is at blog.yourdomain.com/wp-admin (or yourdomain.com/blog/wp-admin). The main site’s dashboard remains at yourdomain.com/wp-admin.
  • Plugins and themes are not shared. Anything you install on one won’t appear on the other. Each one must be updated separately: see how to update WordPress, themes and plugins safely.

What happens with the .htaccess file

The .htaccess is a file with address rules. WordPress creates one in each installation. Two points need attention:

  1. The subfolder sits inside the main site’s folder. The server reads the .htaccess of the main site’s folder and then the one in the subfolder. Redirects and security rules in the main file can therefore affect the blog. The same applies to a subdomain whose folder is inside public_html.
  2. Each WordPress installation needs its own default file. The new site creates its file in the installation folder. If the new site’s links return 404 errors, go to its dashboard, open Settings > Permalinks and click Save Changes, without changing anything.

Before editing any .htaccess, download a copy. To see what the default file looks like, read .htaccess in WordPress: how to find and create the default file. If the problem is inner pages returning 404 errors, see WordPress: inner pages with 404 errors.

After installing

  1. Open the new site’s address and /wp-admin and check that they load.
  2. Check Settings > General to make sure the WordPress Address and Site Address fields show the right address.
  3. Install the subdomain’s SSL certificate if you don’t have one yet: see how to install SSL in cPanel.
  4. Open the main site and check that it still works normally.
  5. If you entered the wrong address, see how to change the domain or address of a WordPress site.

If you have doubts at any step and the main site can’t go offline, contact MigraCloud.

Frequently asked questions

Can I have two WordPress sites on the same domain?

Yes. Just install the second one on a subdomain or in a subfolder. Each installation has its own files, database, users, themes and plugins, and the dashboard of one doesn’t affect the other.

Subdomain or subfolder: which is better for SEO?

There is no single answer that fits every case. Choose based on the project’s organization and ease of maintenance, not on a promise of search gains.

Do I need to create the database before installing with Softaculous?

Usually not. Softaculous creates the installation’s database and user on its own. This can vary depending on the version and the hosting configuration, so check the options on the installation screen.

The subdomain shows a “Not secure” warning. What should I do?

The subdomain probably doesn’t have an SSL certificate yet. Install or enable the certificate in cPanel and then check the site address in Settings > General, so it uses https://.

How do I remove an installation I put in the wrong place?

In Softaculous, in the Installations list, use the remove icon. It deletes that installation’s files and database, so make a backup and make sure the address isn’t the main site’s.

My blog in the subfolder shows 404 errors on its pages. Is that normal?

No. It’s usually the permalinks rule. Go to the blog’s dashboard, open Settings > Permalinks and save without changing anything.

More on WordPress

See all →

Help center

Looking for something else?

See all tutorials, organized by topic.