Sitewalk / Guides / Links / Broken internal links
Broken internal links: how to find and fix them
Broken internal links are links on your site that point to another page on your site, where that page now answers with an error. You fix them by editing the link, restoring the page, or redirecting the old address.
This is one of the few site problems that is fully in your hands. You own the page with the link and you own the page it points to. Nobody else has to reply to an email or approve a change.
What counts as a broken internal link
A link is internal when it points to your own domain. It is broken when the target answers with an error, most often 404 (not found), 410 (gone) or a code starting with 5 (server error).
Sitewalk flags an internal link when the target answers 404, 410 or any 5xx code during the crawl. If the crawl did not visit the target itself, it only flags a clear 404 or 410. That keeps a page that was never checked from being reported on a guess.
A link to another website is a different job, because you cannot repair the other end. We cover that in the guide on broken external links.
Common ways these links appear:
- A page was renamed and the old address was not redirected.
- A page was deleted but menus, footers or old posts still point to it.
- Someone typed the address by hand and missed a letter.
- A relative link such as
setup.htmlwas copied into a page in a different folder. - A site moved to a new structure and part of the old content kept its old links.
Why broken internal links matter
A visitor who clicks one lands on an error page while they were trying to go further into your site. That is the worst moment to lose them.
Search engines are affected too. Google's page on HTTP status codes says Google does not index URLs that return a 4xx code, and URLs already indexed that start returning one are removed from the index. For 5xx errors, Google says its crawlers slow down for a while, and indexed URLs are kept at first but eventually dropped.
Links are also how crawlers find pages. Google's link guidance says every page you care about should have a link from at least one other page on your site. If the only link to a page has a typo, that page may be left with no working path to it. Our guide on orphan pages shows how to spot that.
Status codes and what to do with each
Read the code before you change anything. It decides the fix.
| Target answers | What it usually means | What to do |
|---|---|---|
| 200 | The page loads | Nothing, unless it shows an error message |
| 301 or 308 | Moved for good | Point your link at the new address |
| 302 or 307 | Moved for now | Check whether the move is really temporary |
| 404 | Not found | Fix the address, restore the page, or redirect |
| 410 | Removed on purpose | Remove the link or point it somewhere useful |
| 403 | Refused | Check logins, firewall and security rules |
| 500 to 599 | Server failed | Fix the server or application first |
| No answer | Timeout or network error | Try again, then check the server |
One trap deserves a note. A page can answer 200 and still say that nothing was found. Google calls this a soft 404, and a status code check alone will miss it. Open a few of your passing links in a browser to make sure they show real content.
How to check one page for broken internal links
This short Python script reads one page, collects the links that stay on the same host, and prints the status code of each. It uses only the standard library. Save it as linkcheck.py.
import sys, urllib.request, urllib.error
from html.parser import HTMLParser
from urllib.parse import urljoin, urldefrag, urlsplit
class Links(HTMLParser):
def __init__(self):
super().__init__()
self.found = []
def handle_starttag(self, tag, attrs):
href = dict(attrs).get("href")
if tag == "a" and href:
self.found.append(href)
def fetch(url):
req = urllib.request.Request(url, headers={"User-Agent": "link-check"})
try:
with urllib.request.urlopen(req, timeout=15) as r:
return r.status, r.geturl(), r.read().decode("utf-8", "replace")
except urllib.error.HTTPError as e:
return e.code, url, ""
except Exception:
return "no answer", url, ""
page = sys.argv[1]
status, final, html = fetch(page)
parser = Links()
parser.feed(html)
host = urlsplit(final).netloc
links = {urldefrag(urljoin(final, h))[0] for h in parser.found}
for link in sorted(l for l in links if urlsplit(l).netloc == host):
code, landed, _ = fetch(link)
note = "" if landed == link else " -> " + landed
print(code, link + note)
Run it with your own page:
python3 linkcheck.py https://example.com/
On a small local test site we built with two missing pages, it printed lines like these (we swapped the local address for example.com):
200 https://example.com/about.html 404 https://example.com/old-pricing.html
We also ran it on our canonical tags guide on 26 Nov 2026. Every internal link it listed answered 200.
Know its limits. It reads the HTML as the server sends it, so links added later by JavaScript do not show up. It treats www and the bare domain as different hosts.
It follows redirects and shows where each one landed after an arrow. It checks one page at a time, which keeps the load on your server low.
How to find them from your server logs
Your access log shows the broken addresses that people and bots actually requested. It also shows the page they came from, when the browser sent it.
This command reads a log in the common combined format, keeps 404 answers that came from your own domain, and counts them:
awk '$9 == 404 && index($11, "example.com") {print $7, "linked from", $11}' access.log | sort | uniq -c | sort -rn
Replace example.com with your domain and access.log with the path to your log. We tested it on a made up three line log. It returned the one missing page with the page that linked to it, and skipped a bot request that had no source page.
Logs only show links that someone followed. A broken link on a quiet page may never appear, so use the logs to set priority and a crawl to find the rest. Some sites send only the domain as the source, not the full page. In that case search your content for the missing address.
How to fix broken internal links
Start with the target, not the link. Ask what should happen to that address.
- The address has a typo. Correct the link. This needs no redirect.
- The page moved. Update every link to the new address. Add a 301 redirect from the old one for bookmarks and outside links.
- The page was deleted by mistake. Restore it. All the links start working again.
- The page is gone and a close replacement exists. Link to the replacement and redirect the old address to it.
- The page is gone and nothing replaces it. Remove the link. Let the address answer 404 or 410.
On Apache, these two lines in your server config handle the moved case and the removed case:
Redirect 301 /team.html /about.html Redirect 410 /old-pricing.html
We ran both on a local Apache 2.4 server. The first answered 301 Moved Permanently with the new address in the Location header. The second answered 410 Gone.
Test each rule after you add it. If you use another server or a CMS, use its own redirect setting.
A redirect is a safety net. Still edit your own links so they go straight to the final page. Several redirects stacked together slow visitors down, and our guide on redirect chains and loops shows how to flatten them.
Fix the template before the single page
One broken link in a menu or footer can show up on every page. A report with hundreds of lines often comes down to a handful of targets.
Group your list by target address first. Then work in this order:
| Where the link sits | Why it comes first | Where to edit |
|---|---|---|
| Menu or footer | Appears across the whole site | Theme or layout settings |
| Sidebar or related posts block | Repeats on many pages | Widget or block settings |
| Pages with the most visits | Most people affected | The page editor |
| Older posts | Lower traffic, longer list | The editor, in batches |
Common mistakes
- Redirecting every dead address to the home page. The visitor loses the thing they wanted. Redirect only to a page that answers the same need.
- Hiding errors behind a 200 page. A friendly error page is good, but it must still send the 404 status.
- Fixing the report line by line. Find the shared template and fix it once.
- Trusting the editor preview. Check the published page, because plugins and templates can change links.
- Forgetting the sitemap. Remove deleted addresses from it so you stop pointing crawlers at them.
- Linking to a test address. Search your content for
localhostand staging domains before launch.
Check it worked
- Run the script again on each page you edited. Every line should show 200, with no arrow unless you meant it.
- Request the old address with
curl -Iand confirm the 301, 404 or 410 you intended. - Click the menu and footer links on a phone and on a computer.
- Run the audit again and confirm the finding is gone or the count dropped.
- Repeat after any site move, theme change or bulk delete.
What Sitewalk found on real sites
Counted on 26 Nov 2026: 33 of 133 audited sites (24.8%) had at least one internal link to a broken page. Of 103 sites audited since the redirect check went live on 4 Nov 2026, 30 (29.1%) had an internal link that went through a redirect.
This counts sites with at least one flagged link, using each site's latest audit. It is a small early user group, a first look and not a survey.
Questions people ask
What are broken internal links?
They are links from one page of your site to another page of the same site, where the target answers with an error such as 404, 410 or a 5xx code.
How do I find broken links on my website?
Check a single page with the script above, read your server logs for 404 requests that came from your own domain, or run an audit that crawls the site and lists each broken link with the page that holds it.
Do broken internal links hurt SEO?
The broken address will not be indexed, and a page whose only link is broken becomes harder to find. We did not read a Google statement that a few broken links lower the rest of a site, so we do not claim that.
Should I redirect a 404 page or leave it?
Redirect it when another page covers the same need or when outside sites still link to it. Leave it as 404 or 410 when nothing replaces it, and remove your own links to it.
How often should I check?
Check after every move, rename or bulk delete. A regular pass once a month works well for a site that publishes often.
Check your whole site in one sentence
Audit example.com for technical SEO problems
Checked on 26 Nov 2026. Sources: Google Search Central, How HTTP status codes affect Google's crawlers and Link best practices for Google, read on 26 Nov 2026. Sitewalk counts are from 133 audited sites on 26 Nov 2026.