{"id":1334,"date":"2021-12-12T15:43:36","date_gmt":"2021-12-12T23:43:36","guid":{"rendered":"https:\/\/wpfellows.com\/?p=1334"},"modified":"2021-12-12T15:43:43","modified_gmt":"2021-12-12T23:43:43","slug":"install-wordpress-on-subdomain","status":"publish","type":"post","link":"https:\/\/wpfellows.com\/install-wordpress-on-subdomain\/","title":{"rendered":"How to install WordPress on a Subdomain: Step by Step Guide"},"content":{"rendered":"

In this tutorial, I will explain how to install WordPress on a subdomain. You may have heard that you can install WordPress in a subdirectory, but not on a subdomain. A common misconception is that you can only run your website from the root domain. This is not true! In fact, you can use any available domain name as a base for hosting your website.<\/p>

In this blog post, you will not only learn how to install WordPress. In addition, I’ll give you lots of useful tips to help you get started and avoid mistakes that can really cost you a lot of time and a lot of headaches later on.<\/p>

If you get stuck at any point, just drop me your question below in the comments and we’ll be happy to help you out.<\/p>

Install WordPress on a subdomain in 6 easy steps<\/h2>

Now it’s finally time to get down to business. I will guide you step by step through the installation.<\/p>

Step 1 – Download WordPress<\/h3>

Later in the process, you will manually upload and install the files for WordPress to your site\u2019s server. Of course, you\u2019ll need to download the required files beforehand, so it is best to do it first to make sure you\u2019ve got them handy when the time comes to install them.<\/p>

Head over to https:\/\/wordpress.org\/download\/ <\/a>and hit the download button to download the latest version of the WordPress installation files.<\/p>

\"Download<\/figure>

Unzip\/extract the files and save them to your local drive for now. You will upload the files to your subdomain in a later step.<\/p>

Using Cpanel is the most straightforward option for uploading the files if you have access via your hosting provider.<\/p>

For users who can\u2019t use cPanel, an FTP client such as Filezilla is another option covered in this guide.<\/p>

Step 2 – Create a Subdomain<\/h3>

The process of creating a subdomain can vary depending on which hosting service you are using. Nowadays, many WordPress users use hosting companies that allow for cPanel access.<\/p>

Using Cpanel makes it simple to create a subdomain for your site. <\/p>

When using Cpanel, log into your dashboard and scroll down to the \u201cdomains\u201d section. From here, you will be able to find the \u201csubdomains\u201d option.<\/p>

Once you\u2019ve clicked on the subdomain button, you\u2019ll be able to create a subdomain by filling out the relevant information fields.<\/p>

After you\u2019ve created the subdomain, you need to add a DNS record for your new subdomain. From your Cpanel dashboard, find the option for editing your site\u2019s DNS files. It will be labeled \u201cDNS management,\u201d \u201cDNS zone editor,\u201d or something similar.<\/p>

Once inside your DNS editor, you need to add an \u201cA\u201d record. In the host field, input the name of your new subdomain and fill out the rest of the required information. Add\/save the record.<\/p>

Be aware that it can sometimes take up to 24 hours for the new record to resolve.<\/p>

If you don\u2019t have Cpanel access, get in touch with your hosting provider and ask what steps they recommend for creating your subdomain.<\/p>

Step 3 – Create a New Database<\/h3>

Once your new subdomain has been created, you need to create a new database on it to install the WordPress files.<\/p>

Note<\/strong>: some hosting providers will automatically set up a new database on a subdomain. Be sure to check if a database already exists before using the following steps to create a new database manually.<\/p>

Creating a New Database with cPanel<\/p>

If you have access to it, using cPanel makes it quick and straightforward to create a new database for a WordPress installation.<\/p>

Take the following steps inside the cPanel area for your subdomain:<\/p>

  1. Beneath the \u201cdatabases\u201d section, select \u201cMySQL Database Wizard.\u201d<\/li>
  2. Create a database and enter your desired name.<\/li>
  3. Create a user name and a strong password for logging into your site\u2019s admin area.<\/li>
  4. Add your new username to the database and make sure you have selected the \u201call privileges\u201d checkbox.<\/li>
  5. Finally, complete the task. Make a note of the following values: hostname, username, databasename, and your chosen password. You will need those values later on for editing the WordPress configuration file.<\/li><\/ol>

    Creating a New Database with phpMyAdmin<\/p>

    If you can\u2019t access cPanel with your server, there is a good chance they will have phpMyAdmin installed. Add a new database for your subdomain using phpMyAdmin with these steps:<\/p>

    1. Inside phpMyAdmin, navigate to the \u201cdatabases\u201d tab and fill in the field below the \u201ccreate database\u201d option. Enter the name for your new database.

      In the \u201ccollation\u201d dropdown menu, find the option for your coding and language. For coding, it is generally best to select \u201cutf8_.\u201d

      If you can\u2019t find your specific language, choose general, which will look like this: \u201cutf8mb4_general_ci\u201d.

      Click \u201ccreate.\u201d


      <\/li>
    2. Return to the phpMyAdmin dashboard by clicking the logo in the top left of your page. Navigate to the \u201cusers\u201d tab and select \u201cadd user\u201d from beneath the users list.

      Choose a username and strong password, then enter the information in the relevant text fields. Make a note of your username and password.

      Make sure the options listed in \u201cglobal privileges\u201d are kept to the default setting and click \u201cGo\u201d.


      <\/li>
    3. Head back to the \u201cusers\u201d tab and select \u201cedit privileges\u201d for the user you have just created.

      Find the section labeled \u201cDatabase-specific privileges\u201d and select the database you created earlier.

      You\u2019ll now see the privileges your new user has inside your new database. Make sure everything is checked to give the user full privileges inside the database and click \u201cGo.\u201d


      <\/li>
    4. On the next page, you should see the hostname for your server at the top. It will be listed after the word \u201cServer:\u201d

      Write down your hostname. Most of the time, it will be \u201clocalhost.\u201d<\/li><\/ol>

      Step 4 – Upload WordPress Files<\/h3>

      The WordPress files you downloaded earlier need to be added to the root directory of your site\u2019s domain. <\/p>

      The folder you need to locate in your site\u2019s root directory is the public_html\/subdomain folder. This is the folder where you\u2019ll upload your WordPress files.<\/p>

      Again, the simplest way to upload the files is via cPanel if you have access to it. Inside the cPanel, you can navigate to \u201cfile manager\u201d to view your site\u2019s directory. You can then upload the unzipped WordPress folder directly into the correct location (public_html\/subdomain).<\/p>

      For those who cannot use cPanel, you can use an FTP client like FileZilla<\/a> to connect to your site\u2019s directory and transfer the contents (not the folder itself) of the unzipped WordPress folder from your local drive to the correct location.<\/p>

      \"Upload<\/figure>

      You will need to use the FTP login details from your main account (parent\/original domain) to access the files in the subdomain.<\/p>

      Once connected via FTP, it is a simple case of locating the WordPress folder in your local drive on the left and dragging the contents into the \u201cpublic_html\/subdomain\u201d folder in your site\u2019s files, which are displayed on the right.<\/p>

      After uploading the files using FTP, you can delete the folder named \u201cindex.html\u201d if it exists in your subdomain\u2019s folder. <\/p>

      Step 5 – Edit your wp-config.php<\/h3>

      Among the files you have just uploaded to your subdomain\u2019s directory, you should find a file named \u201cwp-config-sample.php.\u201d<\/p>

      This wp-config-sample file needs to be edited with your subdomain\u2019s database information. The WordPress installer looks for this file and will offer to create one if it isn\u2019t found. However, you can enter the data and create the file manually to help the installation process run more smoothly.<\/p>

      Locate the wp-config-sample.php file and open it in a text editor (not a word processor).<\/p>

      Edit the values in the file to include the information specific to the database you created in step 3 of this guide. Here is the info you\u2019ll need:<\/p>