admin管理员组

文章数量:1394980

Let's say we have a domain for example

www.example

And we have some subdomains for different countries

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

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.

Let's say we have a domain for example

www.example.

And we have some subdomains for different countries

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

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.

Share Improve this question asked Mar 11, 2019 at 5:58 Jordan QuartermainJordan Quartermain 6523 silver badges13 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

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 ponents) I'd remend subfolders as it's likely easier to setup.

If you have plex ponents (or you might in the future) or each site is fairly different I'd remend subdomains for the security gain. If you're unsure if you're going to have plex/sensitive ponents in the future I'd also remend 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.

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 remend 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

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

Checkout this guide : https://edit.co.uk/blog/seo-javascript-redirects-evidence-pass-pagerank/

Doing redirects in JavaScript is definitely a "better than nothing" solution, rather than anything that should be remended. It means placing your trust in something in that is supposed to work work, as opposed to something that definitely will.

I'd make sure there really was no way to do the redirects properly first, before falling back to the last-ditch solution.

Here's a test from a year ago that showed ranking authority was passing through JS redirects, but note all the caveats they include (especially that Bing didn't handle this at all at the time). https://www.branded3./blog/seo-javascript-redirects-evidence-pass-pagerank/

本文标签: javascriptRepercussions of redirecting root domain to subdomainsStack Overflow