Hash URLs and SEO: why #/ routes are not separate pages
Hash URLs like example.com/#/pricing reach the server as one page. See what Google and AI crawlers do with them and how to move to History API paths.
By Crawlito · 9 min read
In short
The part of a URL after # is never sent to the server, so example.com/#/pricing and example.com/#/about both request the same page: /.
Google's JavaScript SEO guide says not to use fragments to load different page content, and its URL structure guide says Google Search generally doesn't support URL fragments.
Google deprecated its #! AJAX crawling scheme in 2015 and pointed new sites to the History API's pushState method.
Moving to History API paths needs a server fallback for deep links and a real 404 for unknown paths, otherwise every bad URL becomes a soft 404.
The server cannot redirect old hash URLs because it never sees them; a small script that reads location.hash can forward visitors to the new paths.
If your single-page app uses addresses like example.com/#/pricing, search engines and AI crawlers should not be expected to treat each #/ route as its own page. The browser keeps everything after the # to itself, so the server only ever sees a request for /. Google's documentation tells developers not to use fragments to load different page content and recommends the History API, which gives every view a real path such as /pricing.
This post explains why that happens, what is and is not documented about crawlers, how to confirm which kind of routing your app uses, and how to move to real paths without leaving old links broken. Fixing the URLs makes each view reachable on its own. It does not decide whether any page ranks or gets cited.
What is a URL fragment, and why does the server never receive it?
A URL fragment is the part after the #. Its job is to point at something inside a document, like a heading, once the document has loaded. RFC 3986 says the fragment identifier is separated from the rest of the URI before any retrieval and is dereferenced solely by the user agent. MDN puts the practical result plainly: the fragment is not sent to the server when the URL is requested, and the browser processes it after the resource arrives.
You can see this yourself. curl strips the fragment before it sends the request:
The server was asked for /, not for /#/pricing. That one fact explains most of the problems in this post.
How does hash routing work in a single-page app?
Early single-page apps could not change the URL path without reloading the page, so they stored the current route in the fragment instead. According to MDN's hash routing entry, the app reads window.location.hash, or listens for the hashchange event, and swaps the view when the fragment changes. MDN calls it a legacy technique that needed no server setup and says it is used, if at all, only as a fallback for very old browsers or for static hosts where server-side routing cannot be configured.
Every common router still offers it:
Router
Hash mode
Path mode
React Router
createHashRouter, which manages the path through the URL hash
createBrowserRouter
Vue Router
createWebHashHistory
createWebHistory
Angular
HashLocationStrategy, the "hash URL" style
PathLocationStrategy, the default "HTML5 pushState" style
Vue's own documentation says hash mode has a bad impact on SEO and that HTML5 mode is the recommended one. So if you see /#/ in your address bar, someone either chose hash mode deliberately for a host that cannot rewrite URLs, or inherited it from a template.
What do search engines and AI crawlers do with the part after #?
Here is what the operators document and what they do not.
Google. Its JavaScript SEO basics guide says: "don't use fragments to load different page content." It describes the hash-link pattern as a bad practice because Googlebot can't reliably resolve those URLs, and recommends the History API instead. Google's URL structure guide gives https://example.com/#/potatoes as its example of what not to do and says Google Search generally doesn't support URL fragments. Google's guidance on crawlable links adds that it can only reliably extract URLs from <a> elements that have an href, so a click handler on an <a> without an href, or on a non-link element, is not something Google can reliably treat as a link.
AI crawlers. OpenAI, Anthropic and Perplexity do not document how their crawlers treat fragments. What the HTTP model above implies is that a crawler asking for /#/pricing is asking for /. And there is a second layer: in Vercel and MERJ's December 2024 analysis, the crawlers from OpenAI (OAI-SearchBot, ChatGPT-User, GPTBot), Anthropic (ClaudeBot) and Perplexity (PerplexityBot) did not render JavaScript. The same article reports that Google's Gemini and AppleBot do render it, so the picture differs by operator. A hash-routed app that fills its views with JavaScript gives the non-rendering crawlers one URL and, in that study's measurements, an empty shell on it. Treat that as a snapshot from a given date, not a permanent rule. Do AI crawlers run JavaScript? covers what is known.
The practical effect for a site with ten hash routes:
The server serves the same HTML for all ten.
There is one title, one meta description and one canonical URL, because there is only one document as far as the server is concerned.
Your sitemap cannot usefully list the other nine, because each entry points at the same fetchable URL as the homepage.
A visitor who shares /#/pricing shares a link that works in a browser but carries no page of its own for a crawler to read.
What happened to #! URLs and the AJAX crawling scheme?
Some older apps use #!/pricing, with an exclamation mark. That came from a 2009 Google proposal for crawling AJAX sites, where the crawler converted #! URLs into requests with an _escaped_fragment_ parameter. Google announced on 14 October 2015 that it no longer recommended the scheme, said that new or restructured sites should avoid _escaped_fragment_ URLs, and pointed to the History API's pushState() method.
The scheme was Google's own proposal, so whether any other crawler ever supported it is a question for that operator. If your app still uses #!, treat it as a legacy URL format to migrate away from, not as a way to get separate pages crawled.
How can you check whether your routes use hash or real paths?
Start with the quickest test, then confirm with the server's view.
Click through the site and watch the address bar. If the path stays / and only the part after #/ changes, you are on hash routing.
Compare what the server returns for two routes. If the output is identical, the server cannot tell them apart:
Request a deep path directly. Try https://example.com/pricing. A 404 or the homepage means the app has no real paths yet.
If step 3 finds no hash router but the address bar still shows #/, look for hard-coded href="#/..." links in templates. The internal links post explains how to list the links a page actually offers in raw HTML.
How do you migrate to History API routes with server fallbacks?
The migration has three parts: switch the router, make the server answer deep paths, and keep unknown paths honest.
1. Switch to path-based routing
In React Router that means createBrowserRouter, in Vue Router createWebHistory, and in Angular the default path strategy. Under the hood these use history.pushState(). MDN notes the URL must be the same origin as the current one and that the browser does not load the new URL after a pushState() call. That last point matters: clicking inside the app works, but a reload, a bookmark or a crawler request asks your server for /pricing cold.
Make sure internal navigation renders real <a href="/pricing"> elements, as Google's example does, and intercepts the click for the in-app transition. Router link components do this for you; onClick handlers on buttons do not. See JavaScript links for the checks.
2. Add a server fallback for deep links
Vue Router's documentation says that without server configuration, visiting a deep URL directly returns a 404, and suggests serving the app's index.html for any path that is not a static file. Its nginx example:
nginx
location / {
try_files $uri $uri/ /index.html;
}
Most hosts have an equivalent rewrite setting. If your host truly cannot rewrite, that is the original reason for hash routing, and the fix is to move hosting or to prerender each route to its own HTML file.
3. Return real 404s for unknown paths
The same Vue page warns about the catch: with a fallback in place, the server no longer reports 404 errors, because every unmatched path serves index.html. Google's JavaScript guide calls these soft 404s and offers two strategies for client-rendered apps: redirect with JavaScript to a URL that returns a 404 status, or add a noindex robots meta tag to the error view. Matching routes on the server and returning a true 404 is more reliable, and the soft 404 post shows how to test it.
4. Remember that real URLs are not real content
Giving each view its own path fixes addressing. It does not put the page text into the HTML the server sends. A client-side rendered app on clean paths can still return an empty shell for every one of them. Client-side rendering and the empty HTML problem and React SPA SEO cover server rendering and prerendering, which is the step that makes the content itself visible.
How do you redirect old hash URLs and update sitemaps and links?
Old hash URLs are in bookmarks, emails and other sites' links, and you cannot redirect them on the server. A server-side 301 needs to see the old URL, and the fragment never arrives. Google recommends permanent server-side redirects whenever possible and says to use JavaScript redirects only if you can't do server-side or meta refresh redirects. A fragment is one case where the server cannot do it, so use a small script that runs before the app boots, for example in the <head> of index.html:
html
<script>
(function () {
var hash = window.location.hash;
if (/^#!?\//.test(hash)) {
window.location.replace(hash.replace(/^#!?/, ""));
}
})();
</script>
This sends /#/pricing and /#!/pricing to /pricing, and leaves ordinary anchors such as #faq alone. It helps people who follow old links. Google notes that rendering can fail, so it might never see a JavaScript redirect, and nothing documented says AI crawlers run one. Do not count on it to pass anything to crawlers; the thing that carries your new URLs is the new, crawlable internal links and the sitemap.
Then clean up the places that still point at the old format:
Internal links. Replace every href="#/..." with the real path. Use a crawl or grep to find stragglers.
XML sitemap. List only the new path URLs, each one a page that returns 200 on its own. XML sitemaps for AI discovery covers format, lastmod and submission.
Canonical tags. Each view needs its own self-referencing canonical on the new path. Google says that if you inject canonicals with JavaScript, there should be only one on the page. See canonical tags and duplicate URLs.
External profiles and ads. Update the links you control, such as social profiles, directory listings and campaigns.
After deploying, check the result from outside the app:
bash
for p in / /pricing /about /no-such-page; do
printf "%s " "$p"; curl -s -o /dev/null -w "%{http_code}\n" "https://example.com$p"
done
The real paths should return 200, and the made-up one should return 404 or serve an error view with noindex. If you are moving other things at the same time, the website migration checklist lists the broader tests.
Frequently asked questions
Does Google index #/ routes as separate pages?
Google's documentation says not to use fragments to load different page content, and says Googlebot can't reliably resolve such URLs. Its URL structure guide says Google Search generally doesn't support URL fragments. Plan on each hash route not being a separate page.
Do AI crawlers see my hash routes?
The AI crawler operators do not document fragment handling. A crawler that follows the HTTP model requests / for every hash route, and in Vercel and MERJ's December 2024 measurements the OpenAI, Anthropic and Perplexity crawlers did not execute JavaScript, so they would receive the same unrendered shell each time. The same article reports that Gemini and AppleBot do render JavaScript.
Are #!/ URLs better than #/ URLs?
No. Google deprecated the #! AJAX crawling scheme in 2015 and told new sites to avoid it. Move those URLs to History API paths too.
Can I keep hash routing on a static host?
You can, but each view stays a single document for crawlers. If your host cannot rewrite URLs, prerender each route into its own HTML file or change hosts so that real paths work.
Will switching to clean URLs improve my rankings?
Nothing here can promise that. It makes each view a separate, linkable address that crawlers are able to request, which is a starting point for being indexed or read. Content quality and many other factors decide the rest.
Check what a crawler gets for your routes
The free check fetches one page without an account and shows whether the main text is in the raw HTML, which is worth running on a path like /pricing once your migration is live. If you want the whole site covered, an audit runs the checks across up to 500 pages with evidence and prioritized fixes.
Filed under Rendering and content. Topics: · javascript, internal-links, rendering, google, troubleshooting
Do AI crawlers render JavaScript? Googlebot does. Most AI crawlers did not in Vercel's 2024 study. What that means for your pages and how to test them.
Client-side rendering can hand AI crawlers an empty HTML shell. See what they receive, the symptoms, the fixes ranked by effort and how to verify each one.
What a canonical tag tells crawlers, the conflicts with redirects, sitemaps and hreflang that get it ignored, and how to audit canonicals with curl in minutes.