After purchasing a domain name, you can install an application with three different options. You can use the primary domain, subdirectory or subdomain for this purpose. Since many hosting companies restrict the plan for one website, you have no other options than using subdomain or subdirectory for installing additional applications. However, many users confuse with subdomains and subdirectories as they look same. In this article, we will explain the differences between subdomain Vs subdirectory along with SEO benefits.
Subdomain Vs Subdirectory – URL Structure
First, let us give an example of how these two URLs will look:
Besides the above difference in URL, there are two other type of subdomains you need to understand.
- Many people use www.yoursite.com as a primary domain. However, www is a subdomain of yoursite.com.
- You can add multiple primary domains using addon domain option in some hosting companies. Addon domains are nothing but subdomains redirecting to main domain. You can learn more about creating addon domain in cPanel in this article.
With this understanding let us deep dive into different aspects of subdomain Vs subdirectory.
1. Installing Applications
There will be no problem when you want to install content management systems like WordPress, Joomla or Drupal using an installer like Softaculous. You can select the subdomain or subdirectory path during installation and the installer will create a subdomain with proper file permissions. However, static HTML sites need simple file upload without any installation process involved. Similarly, you can also install WordPress and other applications manually by uploading the files. In these cases, simply uploading files in a folder will be considered as a subdirectory. Otherwise, you have to first create a subdomain from hosting panel and then upload the files inside the subdomain folder.
2. File Structure and Checking in FTP
Most cPanel hosting companies store both subdomain and subdirectory folders under the primary domain’s /public_html/ folder. Therefore, when you look at the folders in FTP or File Manager, both subdirectory and subdomain folders will look similar. However, in many cases it will not work interchangeably. Accessing either yoursite.com/subdomain or subdirectory.yoursite.com URL in the browser will result in page not found or access denied error.
Note that some companies like SiteGround use custom hosting panel. In this case, the subdomains will have their own /public_html/ folder outside the main domain. However, subdirectories will be inside the primary domain which will change the way you access the files using FTP.
3. Security and File Permissions
Subdirectories in general take the file permission rules of your main domain while subdomains follow their own setup. For example, .htaccess directives are recursively applied to all subdirectories and do not impact subdomains located outside the main domain’s root. Let’s take another example that you have a WordPress installation in primary domain with strong security plugin. And you have PHP application in subdirectory that access the backend file structure. In this case, your security plugin on the primary domain will stop the PHP application from accessing file structure.
On other hand, you can easily do this with subdomain as plugins on primary domain will not interfere with subdomain files. Due to this fact, many PHP applications do not support subdirectory installation. Therefore, make sure to check with the developer before planning to install PHP applications on your subdirectory.
4. SEO Impact
Using subdomain or subdirectory is a major difference when comes to SEO. Search engines like Google and Bing crawl your site and clearly understand the entire folder structure. You can even browse through site folders in Bing Webmaster Tools account under “Site Explorer” section. As you can see in the below screenshot, all subdomains are listed outside the main domain which contains all subdirectories.
- Search engines will instantly crawl your subdirectories as they are part of the primary domain’s structure. You do not even need an XML Sitemap for subdirectory content. However, subdomains especially located outside the primary domain’s location may need longtime for crawling. Therefore, you need to submit XML Sitemap or use URL submission option for indexing your subdomains pages quickly.
- Subdirectories take the same SEO benefits of the primary domain as they are considered as part of the site. On other hand, subdomains are considered as separate sites and follow guidelines for a standalone website.
- You can add subdomains in Google Search Console and track the performance separately. This is not possible with subdirectory installation setup. Though you can submit separate XML Sitemap for subdirectories they will not appear separately in the reporting sections like subdomains. It works similarly in Google AdSense as well that you can add subdomains under the site and track them while there are no options to add subdirectories.
In summary, subdomain or subdirectory will not have big impact when you publish relevant content similar to primary domain. However, if you want to have completely different content then it is recommended to use subdomain instead of subdirectory.
Leave a Reply
Your email is safe with us.