A broken link is a link that no longer takes the visitor where it promised to. The page was deleted, the URL changed without a redirect, the domain expired, or the server behind it stopped answering. Whatever the cause, the result is the same: someone clicked, and they hit a dead end.
The frustrating part is that most broken links are not caused by anything you did. A link you published two years ago was fine the day you added it. This guide covers why links break, how to check one yourself, and how to fix what you find.
Why links break
Links break in two places: on your own site, and on the sites you link out to.
Internal links
These are links between your own pages, and they usually break because of a change you made somewhere else:
- A page was deleted or unpublished, and other pages still point at it.
- A URL was renamed, for example
/blog/seo-tipsbecame/guides/seo-tips, without a redirect. - A site migration or redesign changed the URL structure.
- A typo slipped into the link when it was written.
External links
These point at sites you do not control, which is why they are harder to keep track of:
- The other site removed or moved the page.
- The domain expired or was sold.
- An affiliate program ended, or a partner changed their offer URL.
- The destination now sits behind a login or blocks visitors from some regions.
What a broken link looks like to a browser
Every time a link is requested, the server answers with an HTTP status code. That code is the fastest way to tell a working link from a broken one.
| Status | Meaning | Is the link broken? |
|---|---|---|
200 | The page loaded | No |
301 / 308 | Moved permanently | No, but update the link to the new URL |
302 / 307 | Moved temporarily | No |
404 | Page not found | Yes |
410 | Page permanently removed | Yes |
500 / 502 / 503 | The server failed to answer | Yes, if it keeps happening |
Two failures never produce a status code at all: a timeout, where the server takes too long to answer, and a DNS failure, where the domain no longer resolves to anything. Both are broken links from the visitor's point of view.
How to check a link by hand
You can ask for the status code of any URL from a terminal with curl:
# Print the final status code, following any redirects
curl -o /dev/null -s -L -w "%{http_code}\n" https://example.com/some-page
# Show the response headers, including where a redirect points
curl -I https://example.com/some-pageThe first command prints a single number, such as 200 or 404. The second prints the response headers, where a Location header shows the address a redirect sends visitors to.
This is useful for one link. It stops being practical somewhere around the twentieth.
How to fix a broken link
Once you know a link is broken, the fix depends on what happened to the destination.
- The page moved. Update the link to point at the new URL. If the page that moved is yours, also add a permanent redirect from the old address so that every other link to it keeps working.
- The page is gone, and there is a good replacement. Point the link at the replacement. For an external link this might be a newer article on the same topic, or the same company's updated documentation.
- The page is gone, and there is no replacement. Remove the link, and rewrite the sentence around it if it no longer makes sense without it.
- The server is failing. If the destination returns a
5xxerror or times out, check again later before changing anything. If it is still failing after a day or two, treat it as gone.
On your own site, a permanent redirect is a small piece of server configuration. In nginx, for example:
location = /blog/seo-tips {
return 301 /guides/seo-tips;
}Why checking once is not enough
A link check tells you which links are broken today. It tells you nothing about tomorrow, because the pages you link to keep changing after you stop looking.
That leaves two options. You can schedule a recurring audit and work through it by hand, or you can monitor your links continuously and only hear about the ones that fail. Brokenlink does the second: it rechecks every link you add every 24 hours and sends you the exact URL and error code by email or Slack when a check fails, so a dead link gets fixed in a day instead of being discovered months later.
The short version
- Links break because pages move, get deleted, or go offline, often on sites you do not control.
- A
404or410, a repeated5xx, a timeout, or a DNS failure all mean the link is broken. - Fix a broken link by updating it, replacing it, or removing it, and add a redirect when the page that moved is your own.
- A one-time check goes stale as soon as it finishes. Recurring checks are what keep links working.