JavaScript リダイレクト

暫定日本語訳:何 JavaScript リダイレクト is, どのように Google's render pipeline treats it differently から サーバー-side 301, いつ it's acceptable 最後 resort, と どのように へ implement と detect one — plus どこ meta refresh と History API fit.

初回公開:2026年6月27日 · 最終更新:2026年8月4日 · Advanced
言語
このページには証拠シグナルが1件あります

暫定日本語訳:JavaScript リダイレクト 送信 ユーザー と crawlers へ 新しい URL とともに クライアント-side code (window.ロケーション.replace() または.href). It's least reliable リダイレクト type because Google だけ sees it 後に rendering — which できる be delayed, または fail entirely, とともに no fixed timeline either way. Google's 公式 order of preference is サーバー-side (301/302/307/308) → meta refresh → JavaScript, と its docs say plainly: だけ 使用 JS リダイレクト if あなた できる't do other two. Once Google successfully interprets one, target becomes canonicalization signal — ただし その's ない proven guarantee of identical PageRank または ランキング outcomes へ 301, so treat it as 最後 resort rather than like-向けに-like swap. 使用 them on constrained プラットフォーム とともに no サーバー access, 向けに SPA error ページ その point へ real 404, と little else. If あなた 必要がある 使用 one, 使用 window.ロケーション.replace() in <head>, drop ソース URL から あなた sitemap, と point internal links at final destination. Meta refresh is separate HTML-level リダイレクト, と history.pushState()/replaceState() aren't リダイレクト at all.

暫定日本語案: TL;DR — JavaScript リダイレクト is クライアント-side リダイレクト (window.location.replace(), 暫定日本語案: .href, .assign()) その Google だけ processes 後に rendering — phase three 暫定日本語案: of クロール → render → インデックス登録. サーバー-side 301 is seen at クロール time; JS リダイレクト 暫定日本語案: waits on render queue, と Google gives no fixed timeline 向けに その wait — it 暫定日本語案: できる be quick または it できる take long while, と rendering できる fail outright. Google’s 暫定日本語案: documented preference order is サーバー-side → meta refresh → JavaScript, と 暫定日本語案: docs say へ 使用 JS リダイレクト だけ いつ あなた できる’t do other two. Once Google 暫定日本語案: successfully interprets one, target becomes permanent canonicalization 暫定日本語案: signal — even Google 使用 them on their own blog いつ nothing else 機能 — ただし 暫定日本語案: その’s ない documented proof of identical PageRank または ランキング outcomes へ 301, so 暫定日本語案: それら’re 最後 resort, ない spam signal. legitimate 使用 are constrained 暫定日本語案: プラットフォーム とともに no サーバー config と SPA error ページ その point at real 404. 暫定日本語案: Implement とともに window.location.replace() in <head>, drop ソース から 暫定日本語案: あなた sitemap, repoint internal links, と confirm Googlebot できる fetch JS. 暫定日本語案: Meta refresh is HTML-level (0s = permanent, any delay = temporary), と 暫定日本語案: history.pushState()/replaceState() aren’t リダイレクト at all.

何 counts as JavaScript リダイレクト

暫定日本語案: Script navigation depends on rendering と execution, so it is ない protocol-equivalent 暫定日本語案: へ HTTP リダイレクト. Evidence for this claim Primary standard or official documentation supporting the adjacent article claim. Scope: Protocol semantics and Search behavior are kept separate; no indexing, ranking, or migration-timing guarantee is inferred. Confidence: high · Verified: Google: JavaScript redirects Processing is possible, ない exact-timing または インデックス登録 guarantee. Evidence for this claim Primary standard or official documentation supporting the adjacent article claim. Scope: Protocol semantics and Search behavior are kept separate; no indexing, ranking, or migration-timing guarantee is inferred. Confidence: high · Verified: Google: Redirects and Search

暫定日本語案: JavaScript リダイレクト navigates ブラウザー へ 新しい URL とともに クライアント-side code. 暫定日本語案: 一般的な 方法, と どのように それら differ:

  • 暫定日本語案: window.location.replace("url") — navigates と removes original 暫定日本語案: URL から session history. この is one へ 使用: back button skips 暫定日本語案: リダイレクト ソース instead of bouncing ユーザー straight back.
  • 暫定日本語案: window.location.href = "url" — navigates ただし 保持 original in 暫定日本語案: history, so back button returns へ redirecting ページ (と できる 作成 暫定日本語案: loop). document.location.hrefwindow.location.assign("url") behave 暫定日本語案: 同じ way.
  • 暫定日本語案: history.pushState() / history.replaceState()ない リダイレクト. それら 暫定日本語案: rewrite address bar なしで any navigation または HTTP signal, so crawlers don’t 暫定日本語案: treat them as リダイレクト. SPAs 使用 them 向けに in-app URL changes; それら need real 暫定日本語案: <a href> links (または actual navigations) へ be crawlable.

暫定日本語案: dividing line その matters: .replace(), .href, と .assign() all trigger 暫定日本語案: real document navigation ( difference 間に them is だけ 何 happens へ 暫定日本語案: session history), while pushState()/replaceState() 決して navigate at all — 暫定日本語案: それら touch history state と address bar と nothing else. None of four is 暫定日本語案: HTTP 301; “redirect” here is shorthand 向けに クライアント-side navigation, ない status 暫定日本語案: code.

暫定日本語案: Meta refresh (<meta http-equiv="refresh" content="0;url=...">) is 多くの場合 暫定日本語案: lumped in とともに JS リダイレクト, ただし it’s HTML directive parsed 前に JavaScript 暫定日本語案: runs — separate, more reliable category, covered below.

どのように Google processes JavaScript リダイレクト

暫定日本語案: この is crux. Google’s pipeline runs in stages, と JS リダイレクト と 暫定日本語案: サーバー-side リダイレクト get caught at 異なる ones:

  1. 暫定日本語案: クロール — Googlebot fetches URL と reads raw HTML. サーバー-side 暫定日本語案: 301/302/307/308 is seen right here.
  2. 暫定日本語案: Render queue — ページ その return 200 wait へ be rendered. Google’s docs 暫定日本語案: note ページ “may stay on this queue for a few seconds, but it can take longer than that.” Google doesn’t publish fixed service-level timeline beyond その, 暫定日本語案: so treat wait as unpredictable — it できる be quick, または it できる drag — rather 暫定日本語案: than assuming any specific number of days または weeks.
  3. 暫定日本語案: Render + インデックス登録 — headless Chromium runs JavaScript. この is 最初 暫定日本語案: moment JS リダイレクト exists as far as Google is concerned.

暫定日本語案: 同じ idea I 作る on クロール と 暫定日本語案: in JavaScript SEO applies here: 暫定日本語案: rendering is separate 手順 から fetching, と anything その depends on it 暫定日本語案: inherits その delay と その risk.

暫定日本語案: と risk is real. Google: “While Google attempts to render every URL Googlebot crawled, rendering may fail for various reasons. This means that if you set a JavaScript redirect, Google might never see it if rendering of the content failed.” 暫定日本語案: (Google 検索 Central) 暫定日本語案: During window 前に リダイレクト is processed — と forever, if rendering 暫定日本語案: fails — Google 可能性がある 保つ empty ソース ページ in its インデックス登録.

Google’s 公式 preference order

暫定日本語案: リダイレクト ドキュメント lays out hierarchy から 大半の へ least reliable:

  1. 暫定日本語案: サーバー-side リダイレクト — 301/308 (permanent), 302/307 (temporary). Best 向けに 暫定日本語案: everything: seen at クロール time, unambiguous.
  2. 暫定日本語案: Meta refresh — HTML-level. 0-second meta refresh is treated as 暫定日本語案: permanent リダイレクト (like 301); any delayed meta refresh is treated as 暫定日本語案: temporary.
  3. 暫定日本語案: JavaScript リダイレクト — 最後 resort.

暫定日本語案: Google’s words: “Only use JavaScript redirects if you can’t do server-side or meta refresh redirects.” Permanent リダイレクト pass canonical signal へ 暫定日本語案: target; temporary ones 保つ original in results. (どのように その interacts とともに 暫定日本語案: canonical selection is 超えて on 暫定日本語案: Canonicalization.)

暫定日本語案: Google’s own リダイレクト ドキュメント lists JavaScript ロケーション navigation among 暫定日本語案: its permanent redirection 方法, と says target becomes canonicalization 暫定日本語案: signal once Google has interpreted it — so flat “JS redirects don’t pass PageRank” claim is false. 何 ドキュメント doesn’t establish is その 暫定日本語案: outcome is identical, immediate, または as reliable as サーバー-side 301 — it describes 暫定日本語案: canonical signal, ない guarantee of matching PageRank flow, ランキング, または timing. 暫定日本語案: honest framing: 301 passes signal at クロール time とともに near-certainty; JS 暫定日本語案: リダイレクト passes it だけ if と いつ rendering succeeds, と Google doesn’t promise 暫定日本語案: result する match 301’s outcome one-向けに-one. その gap — ない lost equity — is 暫定日本語案: real cost of choosing JavaScript.

暫定日本語案: この is また なぜ JS リダイレクト aren’t penalty trigger on their own. それら だけ 暫定日本語案: become spam 問題 いつ それら’re 使用 向けに cloaking — 表示 crawlers one 暫定日本語案: ページ と redirecting ユーザー へ something 異なる, または 送信 mobile ユーザー へ 暫定日本語案: unrelated domain. Google’s 暫定日本語案: sneaky リダイレクト 暫定日本語案: policy is について その intent, ない technique.

いつ JavaScript リダイレクト is right ツール

暫定日本語案: There are legitimate ケース:

  • 暫定日本語案: Constrained プラットフォーム. Some shared hosting, CDN, または CMS setups give あなた no 暫定日本語案: access へ サーバー-side リダイレクト rules. JS リダイレクト is 有効 fallback — と 暫定日本語案: notably, Google 使用 JS リダイレクト on their own Webmaster blog because, as Gary 暫定日本語案: Illyes put it, “that was the only thing we could use for 1:1 redirects, and it works on Google” 暫定日本語案: (OnCrawl).
  • 暫定日本語案: SPA error handling. Google explicitly endorses この: “Use a JavaScript redirect to a URL for which the server responds with a 404 HTTP status code.” 暫定日本語案: (Google 検索 Central) 暫定日本語案: single-ページ app その resolves bad route できる リダイレクト へ real 404 endpoint 暫定日本語案: so Google processes error correctly instead of インデックス登録 soft 404.

暫定日本語案: 向けに permanent URL migrations, この is ない ツール — 使用 301. I 作る 同じ 暫定日本語案: point in サイト migrations: JavaScript リダイレクト are 暫定日本語案: 最後 resort, と Google 可能性がある 決して see them.

Static サイト generators: Hugo aliases trap

暫定日本語案: 一般的な surprise: Hugo’s aliases: frontmatter has historically generated 暫定日本語案: meta refresh HTML ページ, ない サーバー-side 301s — と other static generators 暫定日本語案: have done similar things by デフォルト. Generator defaults change 間に versions, 暫定日本語案: so 確認 あなた 現在の deployed version’s actual output rather than assuming; if 暫定日本語案: aliases: isn’t giving あなた 301s, あなた need プラットフォーム-level リダイレクト rules (Netlify 暫定日本語案: _redirects, Cloudflare Workers, Vercel vercel.json) plus (on Hugo) 暫定日本語案: disableAliases: true. I cover この in detail in 暫定日本語案: Hugo SEO.

Implementation best practices

暫定日本語案: If JavaScript リダイレクト is genuinely あなた だけ option:

  • 暫定日本語案: 使用 window.location.replace(), ない .href. As 検索エンジン Journal puts 暫定日本語案: it, JS リダイレクト “typically use window.location.replace() function rather than window.location.href to avoid UX redirect loops” 暫定日本語案: (SEJ).
  • 暫定日本語案: Put it in <head>, ない <body>. ブラウザー parse HTML sequentially 暫定日本語案: と run scripts as それら hit them, so “position JavaScript redirects in the <head> tag rather than <body> to minimize delay” 暫定日本語案: (OnCrawl).
  • 暫定日本語案: リダイレクト へ final destination in one hop. JS リダイレクト へ ページ その 暫定日本語案: itself 301s elsewhere 作る chain; chains waste クロール budget と できる surface in 暫定日本語案: GSC as リダイレクト error.
  • 暫定日本語案: 削除 ソース URL から あなた XML sitemap. Sitemaps すべき list canonical, 暫定日本語案: indexable URLs — ない redirecting ones.
  • 暫定日本語案: Repoint internal links at destination, so それら don’t route 通じて 暫定日本語案: リダイレクト at all.
  • 暫定日本語案: 作る sure Googlebot できる fetch JS. If リダイレクト lives in external 暫定日本語案: script blocked by robots.txt, Google できる’t render it と won’t see 暫定日本語案: リダイレクト.

どのように へ detect JavaScript リダイレクト

暫定日本語案: それら don’t announce themselves like 301 in header, so あなた have へ render:

  • 暫定日本語案: ** crawler とともに JS rendering on.** OnCrawl recommends クロール とともに 暫定日本語案: “JavaScript rendering enabled (5-second timeout minimum)”; Screaming Frog と 暫定日本語案: Ahrefs サイト Audit できる both render. なしで rendering, JS-redirecting ページ just 暫定日本語案: looks like normal 200.
  • 暫定日本語案: Chrome DevTools. Network tab (とともに “Preserve log”) 表示 クライアント-side 暫定日本語案: navigation; リダイレクト Path extension flags it too.
  • 暫定日本語案: In 検索 Console, successfully processed JS リダイレクト 表示 up 下で 暫定日本語案: ページ とともに リダイレクト — 暫定日本語案: 同じ status as any リダイレクト URL, which is normal 向けに non-canonical 暫定日本語案: ソース. その label isn’t guaranteed on any given 確認, though: it reflects 暫定日本語案: whatever Google fetched, rendered, interpreted, と canonicalized at 暫定日本語案: sampled moment, so URL できる 表示 異なる status (または no リダイレクト status 暫定日本語案: yet) 間に checks なしで その being error on あなた end.

何 I’d actually do

暫定日本語案: サーバー-side 最初, すべての time. Meta refresh (0-second) いつ あなた できる edit HTML ただし 暫定日本語案: ない サーバー config. JavaScript だけ いつ both are off table — と then とともに 暫定日本語案: window.location.replace() in <head>, clean sitemap, と 確認 その 暫定日本語案: リダイレクト actually renders 向けに Googlebot. 向けに anything permanent または high-value, 暫定日本語案: extra reliability of 301 is worth almost any effort へ obtain.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.