Check 05.06 · HTTP and redirects

Fix broken internal links

Find the internal links that lead to a 404, 410 or 5xx error, fix them at the source (template, menu, content) and stop them from coming back with every release.

Priority
Critical
Difficulty
Easy
Estimated time
1 h to 1 day
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

A broken internal link is a link from one page of your site to another page of your site that responds with an error: 404, 410, 5xx, or a redirect that ends in an error. This check consists of finding these links, fixing each one at its source (menu, footer, template, editorial content) and setting up a check that prevents them from coming back. Once it is done, a full crawl of the site finds no internal link to a page in error.

Why it matters

Internal links are the main way for crawlers to discover your pages and understand their relative importance. Google points out that it finds most pages by following links. A link to a page in error leads nowhere: the crawler spends a request, the visitor hits a dead end, and the page that should have received the link does not get it.

Broken links almost always have the same origin:

  • Page renamed or deleted without updating the content that referred to it;
  • Typo in a link entered by hand;
  • Migration: absolute links in the content still point to the old structure or the old domain;
  • Template: a broken link in the menu or the footer is broken on every page, and shows up thousands of times in an audit;
  • Badly built relative URL: href="produits/chaise" instead of /produits/chaise produces a different URL depending on the page it is on.

AI assistants that browse your site to answer a question follow the same links as visitors: a broken link interrupts their journey just as it does a human's.

What it improves

  • Crawling Every crawler request serves a useful page. A noticeable effect on large sites or when the error is in a template.
  • Discovery and internal linking The target page receives the link and the context of its anchor text again.
  • Visitor experience Fewer exits on an error page, especially from menus.
  • Perceived quality A site with no dead links looks well maintained. An indirect effect, not measurable on its own.
  • Rankings Google states that 404s in themselves do not penalize a site; the gain comes from restored internal linking.

How to check

A crawl is the only exhaustive method. With Screaming Frog (free up to 500 URLs), start the crawl from the homepage, open the Response Codes tab, filter on Internal, then Client Error (4xx) and Server Error (5xx). Select a URL in error and open the Inlinks tab at the bottom: it lists every page that contains the link, with the anchor text and the location (content, navigation, footer). To export everything at once, use the Bulk Export > Response Codes menu.

Without dedicated software, linkinator crawls the site from the command line (Node.js required):

npx linkinator https://www.example.com --recurse --concurrency 5 --skip "^(?!https://www\.example\.com)" --format CSV > liens.csv

The --skip pattern limits the check to internal links; low concurrency avoids triggering your own server's rate limiting. Another option with nothing to install, wget, available on Linux and on macOS via Homebrew, reports broken links at the end of the crawl:

wget --spider -r -nd -nv -o wget.log https://www.example.com/
tail -n 30 wget.log

Server logs show the broken links that are actually clicked: a 404 whose referrer is a page on your own domain is a broken internal link. For a log in Apache's or Nginx's combined format:

awk '$9 == 404 && $11 ~ /example\.com/ {print $11, $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -n 50

Bing Webmaster Tools also reports broken links in its Site Scan audit. In Search Console, the “Not found (404)” reason in the Page indexing report lists the URLs in error known to Google; the URL Inspection tool may show a referring page in its discovery section.

How to implement

Export the list “source page, broken URL, anchor text, code” and sort it by broken URL. Three families quickly emerge:

Family Sign in the export Where to fix
Template link Same broken URL on every page Menu, footer, sidebar, theme file
Editorial link Broken URL on a few pages, in the body text Content of each page
Generated link Repeated pattern (/tag/…, /page/0/, doubled relative URL) Template or plugin code

Start with template links: one fix resolves hundreds of occurrences.

Step 2 — Decide on the right fix

For each broken URL, apply in order:

  1. The page exists elsewhere: replace the link with the exact current URL, returning 200, with no redirect.
  2. The page has moved and other sites cite it: fix the internal link and also add a 301 redirect from the old URL. See use 301/308 for permanent moves (opens in a new tab).
  3. The page no longer exists and has a close equivalent: point the link to that equivalent, or rewrite the sentence.
  4. The page no longer exists and has no equivalent: remove the link, and let the old URL return 404 or 410. See return 404/410 for removed content with no equivalent (opens in a new tab).

Warning: a redirect does not replace fixing the link. An internal link to a redirected URL costs one more request on every visit. See fix links to redirects or non-canonical URLs (opens in a new tab).

To track the work, keep a table:

Broken URL Code Occurrences Family Fix New target Done on
/offres/pack-pro/ 404 312 Template (footer) Link replaced /tarifs/ 2026-11-25
/blog/guide-2023/ 404 7 Editorial Link replaced + 301 /blog/guide/ 2026-11-25
produits/chaise 404 41 Generated (relative URL) Template fixed /produits/chaise/ 2026-11-26
  • Internal links as root-relative absolute paths (/produits/chaise/) or generated by the CMS, never as plain relative links.
  • Automatic redirect on rename: enable the option in your CMS or plugin that creates a 301 when a slug changes.
  • Scheduled crawl: run the audit again every week or after every major publication. See schedule automated crawls (opens in a new tab).
  • Pre-release check for sites generated by code (see Laravel and Next.js).

Apache

Versions Apache 2.4.

Look for 404s with an internal referrer in /var/log/apache2/access.log with the awk command from the “How to check” section. If the audit shows a pattern of broken URLs coming from an old structure, a RewriteRule can act as a safety net until the content is fixed, but fix the links afterwards.

Nginx

Versions Nginx 1.18 and later.

Same command on /var/log/nginx/access.log. Badly built relative URLs show up as doubled paths (/blog/blog/article) in the 404s.

WordPress

Versions WordPress 6.4 to 7.1; Broken Link Checker 2.x and Redirection 5.x plugins.

  • Detection: the Broken Link Checker plugin checks the links in your content, with a local engine or a cloud engine that requires a free account with its publisher. It lets you edit or remove a link from its list. Deactivate it after the audit if your hosting is modest.
  • Menus: Appearance > Menus, or Appearance > Editor > Navigation on a block theme. A menu item pointing to a deleted page is marked “Invalid”.
  • Bulk replacement: after a backup, replace an old URL across all content with Better Search Replace or WP-CLI:
wp search-replace 'https://www.example.com/ancienne-page/' 'https://www.example.com/nouvelle-page/' --skip-columns=guid --dry-run
wp search-replace 'https://www.example.com/ancienne-page/' 'https://www.example.com/nouvelle-page/' --skip-columns=guid
  • Prevention: the Redirection plugin can monitor permalink changes and create the matching redirect.

Shopify

Versions Shopify admin, all plans, November 2026.

Shopify has no built-in link checker: start from a crawl. Fix menus in Content > Menus, links in product, collection and blog post descriptions in their editor, and theme links in Online Store > Themes > Customize. When you change a product's URL handle, tick the box that creates the redirect: old links will not break, but replace them anyway.

PrestaShop

Versions PrestaShop 1.7, 8 and 9.

Broken links often come from CMS pages and descriptions entered by hand with absolute URLs. Fix them in Catalog and Design > Pages, and check the menu and footer modules (Modules > Module Manager). After changing friendly URLs, regenerate the .htaccess file in Shop Parameters > Traffic & SEO.

Wix

Versions Wix Editor, all plans, November 2026.

Wix offers no built-in link check: start from an external crawl, then fix the links in the editor. The URL Redirect Manager, in the SEO section of the dashboard, acts as a safety net for renamed URLs.

Webflow

Versions Webflow, all site plans, November 2026.

Fix links in the Designer and in the link fields of CMS collections. When you change a slug, tick the 301 redirect option offered in the page settings.

Laravel

Versions Laravel 10 to 13; Pest 2 and later tests.

Generate links with route() rather than hard-coding them: a renamed route triggers a visible error instead of a silent dead link.

<a href="{{ route('products.show', $product) }}">{{ $product->name }}</a>

Add a test that goes through the links on key pages:

it('has no broken internal link on the homepage', function (): void {
    $html = $this->get('/')->assertOk()->getContent();

    preg_match_all('/href="(\/[^"#?]*)"/', $html, $matches);

    collect($matches[1])->unique()->each(function (string $path): void {
        $this->get($path)->assertSuccessful();
    });
});

Next.js

Versions Next.js 15 and 16 (App Router and Pages Router).

Use next/link with root-relative absolute paths. To check a build before it goes live, start the site locally, then run linkinator in continuous integration:

npx next build && npx next start -p 3000 &
npx wait-on http://localhost:3000
npx linkinator http://localhost:3000 --recurse --skip "^(?!http://localhost:3000)"

linkinator returns a failing exit code if it finds a broken link, which blocks the deployment.

Common mistakes

  • Redirecting instead of fixing: the redirect catches visitors coming from outside; the site's own links must target the final URL.
  • Fixing a template link page by page: go back up to the menu or the theme file.
  • Forgetting links outside the content: buttons, breadcrumbs, pagination, category links, structured data and the HTML sitemap.
  • Running an overly aggressive crawl on production: high concurrency can trigger 429s or 503s that are then read as broken links.
  • Ignoring 5xx errors: a link to a page that crashes is also a broken link, even if the page exists.
  • Bulk replacing without a backup or a dry run: a poorly targeted replacement can break serialized URLs in the database; use --dry-run first.

Frequently asked questions

Updated on

Topic checklist (PDF)

And now?

In the “HTTP and redirects” topic

  1. Check that active pages return 200
  2. Use 301/308 for permanent moves
  3. Use 302/307 for temporary moves
  4. Fix redirect chains
  5. Fix redirect loops
  6. Fix broken internal links
  7. Fix broken external links
  8. Create a helpful 404 page
  9. Return 404/410 for removed content with no equivalent
  10. Avoid redirecting all removed pages to the homepage
  11. Fix unjustified 403s
  12. Fix excessive 429s
  13. Fix 5xx errors
  14. Monitor server errors
  15. Use 503 during temporary maintenance