Hash URLs in a Single-Page App: Why #/pricing Is Invisible to Google
Short answer: Google treats everything after a # as a fragment of one page and generally does not index it as a separate URL. If your app shows pricing at example.com/#/pricing and contact at example.com/#/contact, Google sees a single page, the homepage. To make each screen findable, switch to path-based URLs such as /pricing, using the browser History API, and make sure the server returns the right content, or at least the app shell with real links, for each path. Then add unique titles, descriptions and a sitemap.
Why the hash gets ignored
The fragment, the part after #, was designed to jump to a spot within a document. Browsers do not even send it to the server. Search engines follow that logic: example.com/page#section is the same document as example.com/page. Older single-page frameworks borrowed the fragment for routing because it let the page change without a reload and needed no server setup. Google once proposed a "hashbang" scheme, #!, to crawl such pages, but that approach was deprecated and is no longer supported.
The effect for a small business: the homepage may be indexed, but "Pricing", "Services", "Our work" and every product screen are invisible in search, because they have no URL of their own that Google will treat as separate.
How to confirm you have the problem
- Look at the address bar as you navigate your app. If the part after the domain starts with
/#/or#!, you are using hash routing. - Search Google for
site:yourdomain.com. If you see one result, or only the homepage, with few others, that points the same way. - In Search Console, inspect a screen URL such as the pricing one. The tool will report the homepage as the page that was inspected.
- In your router configuration, look for names such as
HashRouter(React Router),createWebHashHistory(Vue Router) oruseHash: true(Angular).
Comparing URL schemes
| Scheme | Example | Seen by Google as separate pages | Server setup |
|---|---|---|---|
| Hash fragment | /#/pricing |
No | None needed |
| Hashbang | /#!/pricing |
No, support was dropped | None needed |
| History API paths | /pricing |
Yes | Server must serve the app for each path |
| Server-rendered pages | /pricing |
Yes, with content in the first response | Framework with SSR or static generation |
| Pre-rendered static files | /pricing/index.html |
Yes | Build step generates files per route |
For brochure-style sites the last two give the strongest result, because the content is present when the page is first fetched. A client-rendered app with History API paths can also be indexed, since Google runs JavaScript, but it is slower and less predictable.
Migration plan
- List every route the app has. Give each a clean, lowercase, human-readable path.
- Switch the router to history mode. In React Router that means
BrowserRouter; in Vue Router,createWebHistory; in Angular, the default path location strategy. - Configure the server fallback. A direct request to
/pricingmust not return a 404. For a static host, add a rule that serves the app shell, or better, a pre-generated file for that route. On a single-page setup the fallback is usually "any unknown path returns index.html". - Return real 404 responses for paths that do not exist in the app. A fallback that serves the shell with status 200 for any junk path creates soft 404 problems; have the app signal not-found and your server send the right code where the framework allows it.
- Give every route its own title and description, set when the route loads, and ideally present in the delivered HTML.
- Render real anchor links. Navigation should use
<a href="/pricing">, not click handlers ondivelements. Google follows links in thehref. - Add each route to the XML sitemap and submit it in Search Console.
- Redirect old hash links. The server cannot see the fragment, so redirect with a small script on the homepage that reads
location.hashand sends the visitor to the matching path withlocation.replace. That helps people with old bookmarks. It does not transfer ranking signals the way a server 301 would, which is acceptable because the hash URLs were never indexed as separate pages.
Check after the switch
- Open three or four deep paths directly in a new tab. Each should load correctly, not show a blank page or server error.
- Run URL Inspection live tests on a few paths and view the rendered HTML to confirm your headings and text appear.
- Make sure canonical tags point to the path version and not to the homepage.
- Check that analytics still records virtual page views for each path.
Illustrative scenario
A small accountancy practice has a quick single-page site built with a template tool: five screens at /#/services, /#/fees and so on. Only the homepage ever shows in search. The developer moves to path-based routing, adds a prerender step that writes a static HTML file per screen, adds a sitemap and a short redirect script for old links. Over the following weeks the "Fees" and "Services" pages begin to appear for their own searches.
Things to avoid
- Keeping hashes for navigation and adding a sitemap full of hash URLs. Google will not treat them as separate pages.
- Using hash routing for marketing pages and history mode only for the app behind login. That split is fine, but do it deliberately.
- Setting canonical to
/on every screen. - Relying on JavaScript to inject the title only after interaction.
FAQ
Can I still use anchors like #contact for jumping within a page?
Yes. In-page anchors are fine for scrolling. They simply do not create separate indexable pages.
Do I need server-side rendering?
Not always. For a handful of marketing pages, pre-rendered static files are simple and fast. Client-only rendering can be indexed but depends on Google running your scripts.
Will switching routing break my existing links?
Old hash links stop mapping to pages on their own. Add a small redirect script for bookmarks and update links you control.
Does this apply to mobile apps?
No. This is about web URLs. Apps use their own deep-linking, which is separate.
If your site is a single-page app that search engines can barely see, talk to us through our enquiry page.