Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Repercussions of redirecting root domain to subdomains

Let's say we have a domain for example

www.example.com

And we have some subdomains for different countries

au.example.com
us.example.com
uk.example.com
eu.example.com

What are the disadvantages to this. I'm speaking from an SEO Google perspective and anything else you may think of?

The problem We have a client side JS redirect that redirect users based on their country code. This is unavoidable currently as we have no control over our backend.

If we use our root domain for the sole purpose of redirecting (via HTACCESS for example) to subdomains (I'd host this elsewhere and change the A records to reflect that), what could be the drawback to the SEO etc.

like image 930
Jordan Quartermain Avatar asked Mar 11 '19 05:03

Jordan Quartermain


People also ask

Can you redirect a domain to a subdomain?

Some web hosts allow you to host multiple domains and subdomains on the same web account, with those domains redirected to a subdirectory of your main domain. For example, if the files for your domain (say) eg-domain.com can also be accessed as example.com/eg-domain/ , this paragraph probably applies to you.

Why you should not use subdomain?

Using a subdomain on your website makes your URL structure look bigger. Subdomains are not regarded as 'proper websites in the eyes of Google users. You will be responsible for more hosting fees as subdomains require separate hosting accounts. A subdomain may not yield your geolocation signal for search engines.

How do I redirect a root domain to a subdomain?

​​ Redirect root domain to a subdomain If you have already added that subdomain at your host, create a corresponding DNS A or CNAME record for that subdomain. Create a proxied DNS A record for your root domain. This record can point to any IP address since all traffic will be redirected prior to reaching the address.

Why subdomain is not good for SEO?

With a subdomain, the posts are featured on a separate website, so the content won't contribute as a major ranking factor for your main site.


2 Answers

So there's a few tradeoffs to using subdomains over subdirectories in regards to where to redirect.

SEO

First off, Google's official documentation claims that it treats subdomains and subfolders identically after a few days (it takes a few days for it to learn how to crawl your subdomains). However, it likely will take a little bit more setup to setup subdomains rather than subfolders. Ultimately, the biggest winner will be whichever is easiest for you to maintain and update as that will allow you to optimize SEO in other ways.

Security

The other consideration between subdomains and subfolders is security. Browsers treat subdomains as separate origins, meaning that the same origin policy will give us some added security benefits. Specifically, this means that content on one origin cannot read content on another origin by default, it must be explicitly granted that approval. So, if you're hosting multiple services across different origins and one of them has a web vulnerability in it, it will be significantly harder for an attacker to jump from that domain to another. Consequently, you can prioritize security efforts for the domains that contain the most sensitive data.

With subfolders, if one page has a web vulnerability, the attacker can easily pivot to attack other pages as well. In this model, the security of your site is as good as your weakest page, rather than each page (subdomain) having its own separate security model.

Conclusion of subdomain vs subfolder

Based on your example, it looks like these websites may have similar content but be localized a bit differently. If that's the case, and your sites are simple (serving static content or not having any particularly sensitive components) I'd recommend subfolders as it's likely easier to setup.

If you have complex components (or you might in the future) or each site is fairly different I'd recommend subdomains for the security gain. If you're unsure if you're going to have complex/sensitive components in the future I'd also recommend subdomains as it errs on the side of caution.

Conclusion of redirecting in general

The redirect in general should have no impact on SEO as Search Engines can use it to index your subdomains. I would however, include a link on the page which does the redirect, just to make it more explicit to Search Engines where the redirect is going to and to help them index.

like image 53
winhowes Avatar answered Oct 14 '22 11:10

winhowes


There's an article Neil Patel wrote on this subject that I read a few months ago. It is my understanding that subdirectories are better for SEO than subdomains in most cases. If that's a viable option, I would recommend it.

However Neil's article goes over SEO optomization techniques to use. Overall it shouldn't affect SEO much especially if subdirectories are an option.

Search Engine Results Favor Subdirectories over Subdomains Search Engine Results

Neil Patel Article: https://neilpatel.com/blog/international-seo

like image 29
Ernie Avatar answered Oct 14 '22 11:10

Ernie