Migrating Legacy Hashbang (#!) & AJAX Fragments to Clean SSR URLs
Legacy #! fragment URLs are never transmitted in HTTP headers to servers—requiring thoughtful client-to-server bridge logic during migrations.
Dmitry K., Technical SEO Lead · SEO Space
Indexation benchmark targets
- HTTP fragment rule
- # not sent to server
- _escaped_fragment_
- Deprecated legacy
Why Servers Cannot See Fragment (#!) Backlinks Directly
HTTP clients strip everything from `#` onward before dispatching requests to your CDN or origin server. A pure Nginx redirect map can never match `/#!/pricing` directly.
Because Google deprecated the old `_escaped_fragment_` crawling specification years ago, any legacy SPA still relying on hash routing remains invisible or uncanonicalized in modern search pipelines.
- Upgrade application routing strictly to History API `pushState` clean pathnames backed by SSR.
- Audit external backlink tools to inventory every referring domain still linking with `#!` paths.
- Inject a lightweight inline boot script on `/` that inspects `window.location.hash` and triggers `location.replace()` to the clean canonical route.
Handling Residual _escaped_fragment_ Requests
If old crawlers or scrapers still request `?_escaped_fragment_=`, issue a permanent HTTP 301 redirect directly at the edge to the modern SSR path.
// Lightweight fragment upgrade shim in <head> of root /
if (window.location.hash.startsWith('#!/')) {
const cleanPath = window.location.hash.slice(2);
window.location.replace(cleanPath);
} Verifying Zero Hash Links Across Internal DOM
Crawl staging with JavaScript rendering enabled to verify zero `<a href="#!/...">` links remain anywhere in navigation, sitemaps, or canonical tags.
| Legacy Artifact | Transport Behavior | Migration Action |
|---|---|---|
| /#!/(slug) | Hidden from HTTP origin | Client JS replace() to /(slug) |
| ?_escaped_fragment_= | Visible in origin query | Edge 301 redirect to clean path |
| Anchor #section jumps | Normal page scroll | Keep unchanged; exclude from canonical |
Need this indexation setup audited on your domain?
Send your website URL. We check raw HTML parity, log crawl hits, canonical discipline, and sitemap architecture manually within 24 hours.