Mismatched Base URLs

No Comments
Mismatched base urls

Element Code: IN-055

TL;DR: A mismatched base URL means the <base href> tag in your page's HTML points to a different domain, subdomain, or path than the page it lives on, so every relative link, image, and script on that page silently resolves against the wrong location.
ISSUE TYPE
HTML markup
SEVERITY
High on affected pages
FIX EFFORT
Low, one tag or template
DETECT WITH
Screaming Frog, view-source
COMMON CAUSE
Staging code in prod

What "Mismatched Base URL" Actually Means

The <base> element is an old, easy to forget piece of HTML that goes in the <head> of a document. It sets the base URI that the browser uses to resolve every relative URL on the page: links, images, stylesheets, canonical tags if they are written relatively, form actions, all of it. When there is no <base> tag, the browser just uses the page's own URL as the base, which is what you want almost all of the time.

A mismatch happens when someone sets <base href="https://staging.example.com/"> or <base href="https://example.com/old-section/"> on a page that does not actually live at that address. I see this constantly after a staging-to-production push where a templating variable did not get swapped, or after a domain migration where a base tag was hardcoded to the old domain and nobody touched it again. It also shows up on multi-region sites where a shared header template sets a base href for one locale and every other locale inherits it by accident.

The tag itself is invisible on the rendered page. Nothing looks broken to a human skimming the site. That is exactly why it survives in production for months: QA clicks around, everything appears to work because the person testing is usually on the correct domain already, or the links happen to still resolve somewhere valid. Then a crawler or a user on a different path hits it and every relative asset breaks.

Why This Wrecks Crawling and Indexing

Search engine crawlers parse the DOM the same way a browser does, including the base tag. If your canonical tag, hreflang alternates, or internal links are written as relative paths (a common practice to keep templates portable across environments), a bad base href rewrites all of them against the wrong root. That means:

  • Relative canonical tags can resolve to a URL on a different domain entirely, which Google will read as a cross-domain canonical, sometimes ignored, sometimes honored in a way you did not intend.
  • Internal links that look fine in the raw HTML actually point crawlers off-site or to a stale subdomain, wasting crawl budget and diluting the link equity you meant to pass internally.
  • Images and scripts referenced relatively fail to load for the crawler's renderer, which can affect how Googlebot evaluates page content during the rendering pass, particularly for JS-dependent pages.
  • Structured data that references relative image or logo URLs (common in Organization or Article schema) resolves against the wrong base, so rich result eligibility can quietly drop.

The nasty part is that this is not a "some links are broken" bug you catch from a 404 spike. It is a resolution bug. The URLs are technically valid, they just point at the wrong place, so your normal broken-link monitoring often will not flag it. You usually catch it because organic traffic to a template-wide section drops, or because Search Console starts reporting canonical URLs you do not recognize.

How the Browser Resolves It, Visually

Page served at: https://example.com/blog/post-a/

NO BASE TAG (correct) href="/contact/" resolves to example.com/contact/ ✓

BASE HREF MISMATCH <base href="staging.example.com"> resolves to staging.example.com/contact/ ✗

Crawler indexes the real page correctly

Crawler follows links to staging or a 404 zone

Same page, same relative links, two different destinations

How to Detect It

This is one of the few technical issues that is trivial to confirm once you know to look, and painful to find if you do not.

  1. View source, not DevTools Elements. Check the raw HTML for a <base> tag in the head. DevTools shows you the resolved DOM, which can mask the problem because the browser has already applied it.
  2. Screaming Frog: run a crawl and check the custom extraction or the "Base" column if you configure an XPath extraction for //base/@href. Compare it against the crawled URL. Any crawl-wide mismatch shows up instantly across every template that shares the header.
  3. Search Console: the URL Inspection tool shows the "Google-selected canonical" versus your declared canonical. If you see canonicals pointing at a domain or subdomain you do not expect, a base href problem is one of the first things to rule out.
  4. Server logs: look for Googlebot requests hitting a staging subdomain or an old path structure it should have no reason to know about. That is often the fingerprint of a base tag sending the crawler somewhere it followed a relative link into.
  5. Sitebulb: its "Base" audit specifically flags pages with a base tag present and will tell you if it differs from the page URL's own origin.
SymptomLikely CauseWhere to Check
Googlebot crawling a staging subdomainBase href hardcoded to staging in a shared templateServer logs, robots.txt hits
Canonical URL in GSC does not match declared canonicalRelative canonical resolved against wrong baseURL Inspection tool
Images missing in rich result previewRelative image path in schema resolved off base domainRich Results Test
Internal link equity not flowing as expectedRelative nav links resolving to old path structureScreaming Frog internal links report
404 spike on an old subdirectory that should be deadBase tag still pointing at the retired pathLog files, GSC coverage report

How to Fix It

  1. Find every base tag in your templates. Grep your codebase for <base across layout files, partials, and any environment config that injects it. Most sites only need one, if any.
  2. Decide if you need the tag at all. Most sites do not. If your relative links already resolve correctly without it, delete it rather than trying to fix its value. Fewer moving parts, fewer future mismatches.
  3. If you do need it, template it correctly. The href should be generated dynamically from the current environment and request host, never hardcoded to a string like "https://staging.example.com" that gets copy-pasted into production config.
  4. Convert critical relative URLs to absolute. Canonical tags, hreflang alternates, and og:image should be absolute URLs regardless of whether a base tag exists. That removes an entire class of resolution bugs and is a best practice independent of this issue.
  5. Re-crawl after the fix. Run Screaming Frog again and confirm the base tag is gone or correct on every template, not just the homepage. Shared headers mean the fix should propagate everywhere, but templating logic sometimes has exceptions for legacy page types.
  6. Watch Search Console for a week. Confirm Google-selected canonicals settle back to your declared ones and that log file crawls stop hitting the wrong host.

What Good Looks Like

No base tag unless there is a specific, documented reason for one. Canonical, hreflang, and social meta tags written as absolute URLs. Internal links can stay relative for maintainability, but they resolve against the actual page URL because nothing is overriding that behavior. A crawl of the site shows one consistent origin for every URL, with zero requests bleeding into a staging or legacy domain.

DO

  • Grep templates for every instance of a base tag before assuming there is only one
  • Use absolute URLs for canonical, hreflang, and schema image references
  • Template the base href dynamically if you must keep one
  • Re-crawl after deployment to confirm the fix propagated site-wide
DON'T

  • Hardcode a base href string that gets copied unchanged from staging to prod
  • Assume a visual QA pass will catch this, since nothing looks broken on screen
  • Leave a base tag in place "just in case" once you confirm it is not needed
  • Rely only on DevTools Elements panel, since it shows resolved URLs, not raw source

FAQ

Does every site need a base tag?
No. Most sites function fine without one because relative URLs resolve against the page's own address by default. The tag is really only useful for edge cases like single-file apps served from multiple mount points, or documentation sites deployed at different subpaths depending on version.
Can this cause a duplicate content penalty?
Not a penalty in the manual action sense, but it can cause Google to select a different canonical than the one you intended, which has the same practical effect: your preferred URL loses ranking signals to a URL you did not mean to promote.
Will fixing the base tag change my URLs?
No. Removing or correcting a base tag does not change the actual URL of the page being served, it changes how relative references on that page resolve. Nothing about your URL structure or redirects needs to change alongside this fix.
Why didn't my QA process catch this before launch?
Because the page renders normally for a human testing on the correct domain, and relative links inside that same origin often still happen to resolve somewhere clickable. The break only becomes obvious to automated systems parsing raw HTML, or to users arriving from an unusual path.
Is this the same issue as canonical tag errors?
Related but not identical. A canonical tag error is usually a direct authoring mistake in the canonical value itself. A base href mismatch is an indirect cause: it can silently corrupt a canonical tag that was actually written correctly as a relative path, which makes it harder to spot during a manual review of the tag alone.
Want a second set of eyes on issues like this across your whole site? An Advanced SEO Audit catches template-level bugs like base URL mismatches before they quietly cost you rankings.

Claude Vincent is a technical SEO consultant focused on crawlability, rendering, and AI-search visibility. He writes the field guides and case studies at SEO ProCheck, with a bias toward the durable, unglamorous work that decides whether search engines and AI answer engines can actually read and cite a site.

About SEO ProCheck

Technical SEO consulting and GEO strategy with 20 years of enterprise experience. Case studies, resources, and tools for search and AI visibility.

Work With Me

Technical SEO audits, GEO strategy, site migrations, and international SEO. Hourly consulting for teams who need hands-on support, not just reports.

Subscribe to our newsletter!

More from our blog