Has Outgoing Links with Malformed Href: How to Fix Them
- October 14, 2024
- Links, Link Structure

This check fires when a page contains anchor tags whose href value is syntactically broken: stray spaces, unescaped characters, doubled protocols, or template placeholders that never got filled in. A malformed href either sends users to a 404, does nothing at all, or resolves to a URL you never intended, and crawlers waste budget chasing the mess. Broken links leak trust and bury real destinations.
What a malformed href looks like
The href attribute is meant to hold a valid URL or a well-formed relative path. It breaks in predictable ways: a leading or trailing space, a space inside the path that should have been %20, two protocols glued together, a raw template variable that the CMS forgot to render, or an href that's just empty. Browsers try to be forgiving and will sometimes resolve a garbage href against the current page, which is how you end up with links to yoursite.com/https://othersite.com. Crawlers are less forgiving and will log the malformed target as a broken link.
These almost always come from templating, not hand-authored HTML. A CMS field left blank, a string-concatenation bug, or a copy-paste from a rich-text editor that smuggled in a non-breaking space are the classic sources.
A real failing example
Here are the most common malformed hrefs a crawler surfaces, each broken in a different way:
<!-- leading space: resolves to yoursite.com/%20https://... -->
<a href=" https://example.com/guide">Read the guide</a>
<!-- unescaped space in path -->
<a href="/case studies/retail/">Retail case study</a>
<!-- doubled protocol from bad concatenation -->
<a href="https://https://example.com/pricing">Pricing</a>
<!-- unrendered template placeholder -->
<a href="{{ post.permalink }}">Full article</a>
<!-- empty href: reloads current page -->
<a href="">Contact us</a>Every one of those either dead-ends the user or points somewhere you didn't intend. The fixes are mechanical once you know the pattern:
<a href="https://example.com/guide">Read the guide</a>
<a href="/case-studies/retail/">Retail case study</a>
<a href="https://example.com/pricing">Pricing</a>
<a href="/blog/full-article/">Full article</a>
<a href="/contact/">Contact us</a>Trim whitespace, encode or replace spaces, collapse the protocol, render the variable, and never ship an empty href.
Malformation types and what they do
| Malformation | Example | What actually happens |
|---|---|---|
| Leading/trailing space | href=" /page/" | Resolves against wrong base or 404s |
| Unescaped space in path | href="/a b/" | Truncated or broken URL |
| Doubled protocol | https://https:// | Invalid host, hard 404 |
| Unrendered placeholder | {{ url }} | Link points to literal text |
| Empty href | href="" | Reloads current page |
| Missing scheme on absolute | href="example.com" | Treated as relative path |
That last one is sneaky: href="example.com" with no slash and no scheme is read as a relative filename, so it resolves to yoursite.com/current-path/example.com.
How to detect it
- Screaming Frog: after a crawl, check the Response Codes tab and filter for Client Error (4xx), then use Bulk Export > Response Codes > Client Error 4xx Inlinks to see the exact anchor and source page. Malformed hrefs usually surface here as odd, doubled, or space-containing URLs.
- Custom extraction: configure a regex extraction on
hrefvalues to flag any containing a space,{{, orhttps://https. This catches malformations that resolve to a 200 by accident but still point somewhere wrong. - View source, not rendered DOM: browsers auto-correct many malformed hrefs, so inspect the raw HTML. Right-click, View Source, and search for
href="followed by a space or a curly brace. - Google Search Console: the Pages report will list unexpected URLs under Not found (404); malformed hrefs frequently create phantom URLs that show up here as crawled-but-broken.
How to fix it
Fix the source, not the symptom. If the broken hrefs come from a template, patch the template so every link is trimmed and properly encoded before output, and make sure placeholder variables always resolve or fall back gracefully. For content authored in a rich-text editor, do a find-and-replace pass for non-breaking spaces and stray protocols. Then re-crawl and confirm the malformed URLs no longer appear in your 4xx export. For links that were pointing to real pages, restore the correct target; for ones that should never have existed, remove the anchor entirely rather than leaving an empty href.
Malformed hrefs often travel with other link problems. Our checks for broken external links and redirected external links catch the downstream symptoms, and the internal linking guide covers how to keep your link graph clean.
FAQ
My browser opens the link fine, so is it really broken?
Browsers aggressively repair malformed hrefs, which masks the problem. Crawlers and other user agents may not repair them the same way, and the "fixed" URL a browser lands on is often not the one you intended. Trust the raw HTML and the crawler, not the browser's forgiveness.
Does an empty href hurt SEO?
An empty href="" reloads the current page and passes no link value anywhere. It's not a penalty, but it's a wasted anchor and a confusing user experience. Either give it a real destination or convert it to a button if it triggers JavaScript.
Are fragment links like href="#section" malformed?
No. A fragment identifier pointing to an id on the same page is valid and useful for on-page navigation. It only becomes a problem if the target id doesn't exist, in which case the link does nothing.
Why do doubled protocols keep appearing?
Almost always a concatenation bug where code prepends https:// to a URL that already includes it. Fix the logic to check for an existing scheme before adding one, and the whole class of errors disappears at once.
Should I disavow or redirect malformed URLs?
Neither. Disavow is for toxic backlinks, not your own broken links. Just correct the href at the source. If a malformed href created a phantom indexed URL, let it 404 or 410 and it will drop out of the index naturally.
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.







