How to Create a Subdomain and Install WordPress on it?

Print View Mobile View

In the tutorial, I will show how to create a WordPress subdomain site on your main domain.

What are Subdomains?
A subdomain is a second website which can be used to host content different than your main website.

Ex. is a URL with subdomain “tips”.
In that ‘.com‘ is the first level domain, ‘site‘ is the second level domain and ‘tips‘ is the third level domain.

Create a Subdomain

I will be using the CPanel interface here but other interfaces would be almost similar.

Log into your web hosting account and find ‘Subdomains‘ option. This will be located under the ‘Domains‘ section in CPanel.

Subdomain Option in CPanel

You should see other options such as ‘Addon Domains’, ‘Parked Domains’, ‘Redirects’, ‘Simple DNS Zone Editor’ and ‘Advanced DNS Zone Editor with it in the section. Click on the ‘Subdomains‘ option.

On the next page, enter the name that you want as your subdomain in the first text box. This can be any name you like but you should pick one that relates to the content you are going to have on the sub domain.

If you have more than one domain under this account, select the appropriate one from the dropdown box.

Create Subdomain

Document Root‘ is the directory in which WordPress is to be installed. As per the above image, a directory called ‘sub’ will be created under your main domain. If you want to create an entirely different folder for your new domain, set path as shown in below image.

Finally click the ‘Create‘ button. That’s it! You now have a subdomain.

Now WordPress can be installed in two ways:

  • Manually: You download WordPress and upload it your web host.
  • Automatic: Run the Fantastico De Luxe installer. This is the quick and easy method. It’s also recommended if you don’t have much experience.
Manually Install WordPress on Subdomain
MySQL Wizard in CPanel

Next step is to create a MySQL database which WordPress is going to use. To do this, on the CPanel homepage, scroll down to the ‘Databases‘ section and click on ‘MySQL Database Wizard‘.

Enter the name you want to assign to the database.

Create a Database

Your account username might be the prefix for the database name, followed by an underscore.

Make a note of the database name, along with the new username and password you create. You’ll need it later when you configure WordPress.

Create Database User

Next, check the box to give ‘ALL PRIVILEGES’ to the user, and click on ‘Make Changes‘.

Assign Privileges to Database User

Your subdomain and MySQL database is now configured and ready for WordPress installation.

Now download, in zip format, the latest version of WordPress and extract to a folder on your hard drive.

In the newly created folder there’s a file named ‘wp-config-sample.php,’ rename it to ‘wp-config.php‘ and open it in a text editor. Edit the below lines with your MySQL database name, username, and password.

/** The name of the database for WordPress */
define('DB_USER', 'username_here');
/** MySQL database username */
 define('DB_USER', 'username_here');
/** MySQL database password */
 define('DB_PASSWORD', 'password_here');

Below that you get authentication unique keys and salts. To generate your unique phrase visit this page and replace it with the below ones.

 define('AUTH_KEY',         'put your unique phrase here');
 define('SECURE_AUTH_KEY',  'put your unique phrase here');
 define('LOGGED_IN_KEY',    'put your unique phrase here');
 define('NONCE_KEY',        'put your unique phrase here');
 define('AUTH_SALT',        'put your unique phrase here');
 define('SECURE_AUTH_SALT', 'put your unique phrase here');
 define('LOGGED_IN_SALT',   'put your unique phrase here');
 define('NONCE_SALT',       'put your unique phrase here');

Save and exit the file. More wp-config.php editing options are available but are optional.

Next step is to upload WordPress installation to your web host. For this you will you will need a FTP client. FileZilla is a good opensource option.

Files Section in CPanel

In your FTP client, you’ll have to enter your host settings, username, and password. To get these, and/or to create a new FTP user account scroll down to the ‘Files‘ section in CPanel and choose ‘FTP Accounts.’

On this page, you will be able to create a new FTP user account and it will also display the web host settings.

Some web host may also provide downloadable configuration settings for your FTP client.

FTP Configurations

Use that configuration file and/or manually enter settings in your FTP client to log into your web host account.

After you login, browse to the new subdomain directory created and upload WordPress into that.

Note: Do not drag and upload the entire ‘WordPress‘ folder onto your web host. Upload the files and folders inside ‘WordPress‘ folder.

Finally visit your new subdomain website in your web browser and complete WordPress installation by creating an administrative account. You will need to enter the blog name, your email address, admin username and password. That’s it! WordPress is now installed. You can now log in to your WordPress blog and start blogging

Install WordPress on your Subdomain with Fantastico Installer

In your CPanel homepage click on ‘Fantastico De Luxe‘ option. This should be located under the ‘Software/Services‘ section.

Fantastico De Luxe option in CPanel
WordPress option in Fantastico De Luxe

In the Fantastico De Luxe installer, look for ‘WordPress‘ option under the ‘Blogs‘ section. After you click on it the next option you should see is an option for a ‘New Installation‘. Begin installing by clicking on that.

In the ‘Install on domain‘ option, click on the dropdown box and select the new subdomain you created.

If you cannot see your subdomain, it means that it was not created correctly. Go back to your CPanel home page and create the subdomain again.

Leave the ‘Install in directory’ option blank so that WordPress installs into the root directory of your subdomain.

Next fill in the blog name, your email address, an admin username and password. The email that you enter will be mailed with details such as where WordPress was installed, the full installation path, the Public URL, Admin URL, Username, Password, MySQL database and MySQL username.

That’s it! You have completed your quick WordPress installation on a subdomain. Now you can log in to your WordPress blog and start blogging.

9 thoughts on “How to Create a Subdomain and Install WordPress on it?”

Comments are closed.