Malformed Base URL: How One Tag Breaks Every Relative Link

No Comments
Malformed base url: how one tag breaks every relative link

What this check flags

This check fires when the <base href> tag in your document head holds a malformed or non-absolute value, because the browser then uses that broken base to resolve every relative URL on the page. One bad tag can silently redirect your links, images, and scripts to addresses that do not exist, and it does it site-wide wherever the header template is reused.

How one tag breaks every relative link

The <base> element sets the reference point for all relative URLs in a page. When it is well formed, relative links resolve against it cleanly. When it is malformed, they resolve against garbage. Here is a head that ships a broken base:

<head>
  <base href="example.com/shop">
  ...
</head>

<body>
  <a href="cart/">View cart</a>
  <img src="img/logo.png">
</body>

The value example.com/shop has no scheme and no trailing slash, so the browser treats example.com as a relative path segment. The cart link resolves to something like https://yoursite.com/example.com/cart/, and the logo points at a path that returns 404. Nothing looks wrong in the source; the damage happens at resolution time. The fix is an absolute URL with a scheme and a trailing slash on the directory:

<head>
  <base href="https://example.com/shop/">
  ...
</head>

Now cart/ resolves to https://example.com/shop/cart/ and img/logo.png to https://example.com/shop/img/logo.png, exactly as intended. In most cases the safer move is to remove <base> entirely and let URLs resolve against the page's own address, which is what the browser does by default. Only keep a <base> when you have a specific reason and can guarantee its value.

Common malformed values and what they do

base href valueProblemEffect on relative URLs
example.com/shopNo scheme, no trailing slashTreated as a path; links resolve under a bogus folder
//example.com/shop/Protocol-relative, no explicit schemeWorks but ambiguous; some crawlers mishandle it
https://example.com/shopMissing trailing slash on a directoryLast segment dropped; cart/ resolves under /
empty href=""No valueUndefined base; relative URLs may break unpredictably
https://example.com/shop/NoneCorrect; relative URLs resolve as intended

How to detect it on your own site

  1. curl the head. curl -s https://example.com/ | grep -i "<base" prints the tag exactly as served. If the value has no https:// scheme or the directory has no trailing slash, that is your fault.
  2. Screaming Frog. Add a Custom Extraction with XPath //base/@href to pull the base value from every crawled page, then sort the column to spot any that are not clean absolute URLs. This catches templates that inject a bad base across a whole section.
  3. Browser DevTools. On a page with broken images or links, hover a relative link and read the resolved address in the status bar; if it contains a doubled or nonsense path, trace it back to <base>.

How to fix it

  1. Decide whether you need <base> at all. If nothing depends on it, delete it and let URLs resolve against the page.
  2. If you keep it, set an absolute value with a scheme (https://) and a trailing slash when it points at a directory.
  3. Fix it in the header template, not per page, since the tag is almost always shared across the site.
  4. Never let a CMS or builder emit a base without a scheme; a protocol-relative or schemeless value is a frequent culprit.
  5. Re-crawl and confirm relative links and images now resolve to valid, existing URLs.

FAQ

Do I even need a base tag?

Rarely. Browsers resolve relative URLs against the document's own address by default, so most sites work perfectly with no <base> at all. It exists for narrow cases like single-page apps with virtual paths. If you cannot state why yours is there, removing it is usually the cleanest fix.

Why is the trailing slash such a big deal?

Because URL resolution treats the last segment after the final slash as a file, not a folder. https://example.com/shop makes the browser resolve relative links under /, dropping shop, whereas https://example.com/shop/ keeps them inside the directory. One slash changes every relative link on the page.

Can a malformed base tag hurt indexing?

Yes. If relative internal links resolve to non-existent URLs, crawlers follow them into 404s, waste crawl budget, and may fail to discover real pages. Canonicals and other relative references in the head can break too, which is why this is filed under indexation.

Is a protocol-relative base (//example.com/) acceptable?

It resolves in browsers, but it is ambiguous and some tools handle it inconsistently. Use an explicit https:// so there is no guessing about the scheme.

How does this relate to canonical or hreflang problems?

A bad base warps every relative URL, so relative canonicals and alternates inherit the breakage. That is one reason to keep those tags absolute; see canonical is a relative URL.

For related base-tag faults, see multiple base URLs and mismatched base URLs. When a broken base sends links into dead ends, the downstream symptom is covered in broken internal URLs.

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