大网数据广告活动
网站运营与故障问答

Multilingual SEO and Single-page application

· 52CE 我爱测

I have a website (Single-Page Application) in VueJS, and want to implement localized versions with URLs like these: http://example.com/en http://example.com/de http://example.com/it I'm trying to figure out if I can redirect user…

问题原文

原帖链接 · Oleg · CC BY-SA 4.0

I have a website (Single-Page Application) in VueJS, and want to implement localized versions with URLs like these:

I'm trying to figure out if I can redirect user to his local version depending on his Accept-Language

Google suggests to:

Avoid automatic redirection based on the user’s perceived language. These redirections could prevent users (and search engines) from viewing all the versions of your site

however it looks like some sites (e.g. Microsoft, TeamViewer) do this via 302 HTTP redirection.

I also consider the option to redirect via JavaScript pushState method (change URL without page reload).

So my questions are:

  • would redirection to user's personal language version harm SEO?
  • which redirection method would be preferable (HTTP 301 redirection, HTTP 302 redirection, JavaScript pushState)?

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

It can be fine for SEO to redirect the base URL of the domain to a language based on the Accept-Language header. The only SEO concerns are:

  • Test your rules for case in which the language header doesn't list one of the languages you support.
  • Test your rules for no Accept-Language header sent at all. (Most bots won't send one).
  • You need a fall-back page that says "Choose your language" which has links to your site in each supported language. You shouldn't implement at default redirect language. That will ensure that bots know about all your languages and don't end up massively preferring one of them.
  • You should avoid linking to your base domain when possible. Link directly to the language subdirectory when the language is known. There should be no internal links to your base domain without a language directory, and any external links that you control should include the language directory.
  • It would be best to use a 302 Temporary redirect for this purpose because it will be understood by all bots. Changing the URL with JavaScript could work for Google, but is unlikely to work for other search engines.

Other SEO issues with language redirects stem from disagreements between the language specified in the URL and the Accept-Language header. If you redirect away from a language in the URL because of the Accept-Language header, it will frustrate some users. The Accept-Language header can be wrong in many cases. See How should I structure my URLs for both SEO and localization:

  • Many users do not have this header set correctly. This is especially true for users traveling abroad that may be using a friend's computer, or an internet cafe. It is also often true for international users that install an English web browser and know enough English to be get around, but would prefer content in a different language.
  • Google just announced that Googlebot will send the Accept-Language header and crawl from different geographic locations. However, Google still recommends that you have separate URLs for content in different languages.
  • You may use the Accept-Language header to suggest that users might prefer a different version of the site by displaying a message when the site they are visiting does not match the Accept-Language header.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2020-03-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。