A <base> tag allows you to specify a default path for all the relative URLs on a page.
When you set the base URL in the header section at the top of a page, all the following relative links will use it as a base—hence the name.
Only one <base> Tag HTML element can exist in a document, and it must include an href, target attribute, or both at once. Like other HTML elements, such as title tags, the <base> tag must be located in the <head> section of the HTML.
Ideally, you should place the <base> tag as early as possible in the head section. Doing so will allow you to use it as a reference point instead of the original Url from that point forward.
Keep in mind that you can only define the <base> tag once. After it has been determined, it will impact all relative URLs. As such, you will need to use the absolute URL to override any defaults in your <base> tag that you don’t want to use.
In this post, you will learn:
<base> tags make it easy to create relative links in templating languages without considering every link’s context. As such, using <base> tags can save you a lot of time.
<base> HTML tags are especially beneficial in situations where you have the ability to override defaults when necessary. For example, if you use a templating language that allows you to place shortcuts, you will have the option to easily override any default settings in your base tag when necessary.
If you don’t have full control over the use of all URLs, you might want to think twice about using <base> tags. In the case that your base href pointed to an empty or malformed URL, all the relative links using the URL as a base would also be invalid.
When search engines crawl your website, they will then encounter thousands of malformed links. The presence of so many invalid links would prevent crawlers from finding the destination URL, which would negatively affect the crawling, indexing, and ranking of your site.
Due to the significant impact that <base> tags have on the relative links on your website, it’s crucial to keep an eye out for any <base> tag issues when performing a site audit.
When used incorrectly, <base> tags have the potential to derail your internal linking strategy and lead to errors when crawling your website. To ensure that <base> tags help rather than harm your SEO efforts, we suggest implementing the following best practices.
As previously stated, HTML standards dictate that only one <base> tag element can exist on a web page. However, errors can sometimes occur that cause two different base directives to exist on a single page.
In such cases, search engines and browsers may receive conflicting signals regarding the way that relative URLs are referenced. To ensure that accurate information gets sent out, it’s crucial to remove the incorrect <base> directive.
More on this issue: Base Tag Points to Different Page
Similar to how different base directives on a single page can confuse search engines, duplicate base tags can also result in errors. As such, it’s important to delete extra <base> tags—even if the same <base> tag has simply been duplicated—so that only one base tag exists.
More on this issue: More Than One Base Tag Found
Another base tag SEO best practice is to make sure that the base tag references its own folder path. If the base tag points to the URL or path of another page, the relative links on the page will be viewed as relative to the other page’s path.
More on this issue: Two Different Base Directives Found on Page
All base tags should have a proper URL. If your base tag <base> contains an invalid HREF, search engines will encounter numerous malformed links and crawling errors will occur.
More on this issue: Base Tag Contains Malformed or Empty URL
To avoid crawling errors, the <base> HREF should point to the folder path rather than the web page that it is on. Having the <base> tag point to the actual page URL is a coding mistake that can cause crawlers to discover a plethora of malformed links, ultimately leading to crawling errors on your site.
More on this issue: Base is Found on Page and is Same as Page
If you discover that the base tags on your site don’t meet the above criteria, the SEO execution platform ClarityAutomate expedites the optimization process.
In a matter of minutes, you can update base tags and implement fixes—all without reliance on a dev team—across thousands of pages to improve the SEO value of your site.