Knowledge Base - Resources - seoClarity

Base Tag Contains Malformed or Empty URL

Written by Suraj Lalchandani | March 28, 2023

The <base> element provides a reference for relative links on the page.

Luckily, you can update your <base> tags and add a proper URL — here’s how.

Table of Contents

The Challenge With an Invalid <base> href

Having the <base> href attribute point to a malformed or empty URL is incorrect and would lead to search engines encountering thousands of malformed links, causing errors when crawling your site.

How to Add a Valid Folder Path

If your <base> tag includes an empty or malformed URL, the attribute will need to be updated to include a proper folder path.

Here is an example of an empty <base> tag:

<base href="">

If you’re adding an HREF to the tag, it shouldn’t include the specific URL of the page itself, but rather the <base> URL and/or target for all relative urls on the page. Take a look at these examples:

Correct: <base href="https://domain.com/">
Incorrect: <base href="https://domain.com/example">

If a <base> tag already contains a URL, it may be malformed. Common errors include typos and misspellings.

To make updates to your <base> tags to resolve either of these issues, you’ll need to make changes to your site’s code. If you can’t do this through the CMS, you can bring in the dev team for assistance.

How to Update Base Tags at Scale

Another approach to updating <base> tags involves SEO execution platform ClarityAutomate. With this method, you can scale your optimizations across your site and implement changes in minutes without relying on your developer resources.

1. Select what you'd like to optimize: Code

The first step is to specify what to optimize. To update <base> tags, you must update the code.

2. Choose how you'd like to optimize it: Update

This fix requires an update since the tag already exists.

3. Location: CSS/XPath that points to the <base> on the page

Enter the XPath of the tag that needs the optimization.

4. Attribute: href

This step focuses on the href of the <base> tag.

5. New Value: The correct href of the <base> or target for all relative urls on the page

All that’s left to do is enter a valid href and push the changes live.

Before and After

A few clicks in ClarityAutomate is all it takes to update a <base> tag to add a valid HREF.

Looking for other base tag issues?