{"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>
Now it’s finally time to get down to business. I will guide you step by step through the installation.<\/p>
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> 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> 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> 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> 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> 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> 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> 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> Here are the lines of code in the config file you need to edit:<\/p> You should have all of the required information due to going through step 3 in this guide and creating your database. Your hosting provider should be able to give you any information you do not have.<\/p> Important<\/strong>: rename the file wp-config.php and save it.<\/p> The next step (and hopefully, final) is to run the WordPress install script. To run the script, open your web browser and visit the following URL: <\/p> mysubdomain.mysite.com\/wp-admin\/install.php<\/em><\/strong><\/p> At this point, you can select your preferred language and let WordPress run the script.<\/p> In the steps so far, you haven\u2019t created a WP-config.php file, so the installer will alert you of this and offer to create a file for you.<\/p> At this stage, you are going to need the details for the database you created earlier. Enter the information in the text fields and select \u201csubmit.\u201d<\/p> WordPress will now prompt you to enter some details regarding your website.<\/p> Once the fields have been filled out, click \u201cInstall WordPress.\u201d<\/p> If the installation was a success, you will now be greeted with the standard WordPress login page.<\/p> In terms of SEO, it can be difficult to provide a blanket statement that says one is better than the other. As with most things related to SEO, the best site structure can depend on several other factors.<\/p> All we can do is use the facts from Google and take them into account when deciding whether or not a website\u2019s content should be placed inside a subfolder\/subdirectory or on a subdomain.<\/p> Firstly, Google will rank the content on subfolders and subdomains the same way. The same overall ranking factors apply to both.<\/p> The most critical fact is that a subdomain will be treated as an independent entity. In other words, the content on a subdomain will be treated as an entirely separate site by Google.<\/p> This means your subdomain\u2019s content will not benefit from any SEO boosts that the parent site could provide, such as site authority, backlinks, and internal link structures.<\/p> With this in mind, most sites would be better using subfolders for content than subdomains for SEO purposes, unless the content on each is unrelated or there are branding reasons for creating subdomains.<\/p> For example, some big media sites will host different content categories on subdomains so that search engines essentially view each subdomain as an authority site on that specific topic.<\/p>","protected":false},"excerpt":{"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 … Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":1412,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"limit_modified_date":"1","last_modified_date":"2021-12-12T15:43:43","inline_featured_image":false,"footnotes":""},"categories":[29],"tags":[],"class_list":["post-1334","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"yoast_head":"\n<\/figure>
Step 2 – Create a Subdomain<\/h3>
Step 3 – Create a New Database<\/h3>
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>
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>
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>
Write down your hostname. Most of the time, it will be \u201clocalhost.\u201d<\/li><\/ol>Step 4 – Upload WordPress Files<\/h3>
<\/figure>
Step 5 – Edit your wp-config.php<\/h3>
<\/figure>
define( 'DB_NAME', 'database_name_here' );\ndefine( 'DB_USER', 'username_here' );\ndefine( 'DB_PASSWORD', 'password_here' );\ndefine( 'DB_HOST', 'localhost' );<\/code><\/pre>
Step 6 – Install WordPress<\/h3>
Subdomains vs. Subfolders: Which Is Better for SEO?<\/h2>