A subdomain is an additional part of your main domain name. Subdomains are basically created to organize different parts of your website. You can create multiple subdomains on your main domain.
In this example, ‘api’ is the subdomain, ‘mywebsite’ is the primary domain and ‘.com’ is the top-level domain (TLD). You can use any text as your subdomain, but you want to make sure it’s easy to type and remember.
Need of Subdomain
You can use a subdomain to extend your service like your subdomain can contain some features that can be used by third-party apps and you can use your main domain to provide the service to other customers.
You can create a subdomain to provide an API of your service.
How to create Subdomain
Subdomain vs Subdirectories
Search engines view subdomains and subdirectories differently. Let’s look at why this is true, and how using a subdomain vs a subdirectory affects SEO. Subdomains are seen by Google and other search engines as a different website. This means that search engines must crawl and index each subdomain separately.
You should only use subdomains if you have a good reason to do so. For example, you can use subdomains to rank for different keywords, target a specific market, or reach a different location or serve a language other than that of your main website.
Subdirectories are files found under your primary domain. Google and other search engines do not see subdirectories as separate sites, so “link juice” and SEO are shared between your domain and subdirectories.