How to Fix Broken Links Before Launch

Broken links erode trust faster than mediocre typography. A visitor who clicks "Pricing" and lands on a 404 wonders if your product is abandoned before they read a single feature bullet. Static sites have no server framework to auto-repair routes—you own every href in HTML. This how-to walks through a practical pre-launch link audit for LaunchStatic-style projects: scripted crawling, root-relative path rules, external link hygiene, and sign-off criteria aligned with our deployment checklist.

Categorize links before you test

Group links into internal (same domain), asset (CSS, JS, images), and external (docs, social, Formspree). Each category fails differently. Internal broken paths are your bug. External failures may be temporary outages—but repeated dead GitHub or Twitter links still look sloppy. Export a list from your editor with project-wide search for href= and src= if you do not yet run automated tooling.

Prefer root-relative paths

Root-relative URLs start with / and resolve correctly on localhost:8080, *.pages.dev, and custom domains without edits. Relative paths like ../templates/index.html break when you move files between folders or when trailing slash rules differ across hosts.

<!-- Good -->
<a href="/templates/">Templates</a>
<link rel="stylesheet" href="/assets/css/main.css">

<!-- Risky when files move -->
<a href="../templates/index.html">Templates</a>

Exception: single-file HTML downloads meant to open from disk may intentionally use relative asset paths—keep those bundles separate from production site pages.

Run a local static server, not file://

Browsers treat local files differently; root-relative links fail under file://. Serve the repo root:

python -m http.server 8080 --directory .
# Visit http://localhost:8080 and click every nav item

Click header, footer, in-content CTAs, breadcrumbs, and mobile menu items. Note any 404 or blank CSS—both indicate path problems.

Automate with a link checker

Manual clicks do not scale past twenty pages. Use a CLI crawler against your local server or staging URL.

# Example using lychee (install from GitHub releases)
lychee --offline http://localhost:8080 \
  --exclude-path ./demos \
  --max-concurrency 4

Alternative tools include linkinator and htmlproofer. Configure excludes for third-party URLs that block bots (some social networks return 999 errors to crawlers—verify those manually). Fail the build on 404 for internal routes in CI if you adopt GitHub Actions later.

Fix common static-site mistakes

Missing trailing slash on directory indexes: Some hosts redirect /guides to /guides/; others 404. Match your host docs—Cloudflare Pages serves index.html in folders with or without slash but stay consistent in links. Case sensitivity: Linux hosts treat /Templates/ and /templates/ as different paths. Stale blog links: Renamed files leave ghost URLs—grep for old filenames. Hash-only links: #pricing fails if the section id moved—confirm ids exist.

Validate external and mailto links

Open external targets in new tabs with rel="noopener noreferrer" for security. Confirm documentation links point to current vendor paths—Cloudflare and GitHub reorganize docs periodically. Test mailto: addresses on a real mail client. Form actions should POST to live Formspree IDs, not placeholder endpoints copied from demos.

Re-test after custom domain cutover

DNS changes do not fix broken relative paths, but they expose mixed-content issues if any asset still references http://. Run the crawler again on https://yourdomain.com immediately after SSL activates. Update sitemap.xml and canonical tags if hostname changed from staging.

  • Header and footer links verified on mobile menu
  • CSS, JS, and favicon load without 404
  • 404.html renders for unknown paths
  • External docs links return 200 in spot checks
  • No placeholder href="#" on primary CTAs

Document ownership going forward

Add "link check" to your release checklist markdown. When adding a how-to article, link it from the hub page the same commit—orphan pages harm SEO and hide broken routes longer. Schedule quarterly crawls; blogs accrue broken outbound links naturally as the web rots.

Check redirects and status codes

A link that returns 302 to the correct page still works for humans but may dilute SEO signals if temporary redirects linger. Prefer 301 for permanent URL moves. Tools like curl show status chains: curl -I https://example.com/old-path. Fix redirect loops immediately—they surface as "too many redirects" in browsers and fail crawlers entirely.

Preview deployments deserve a pass too

Cloudflare Pages preview URLs use random subdomains. Links with hard-coded production domains break in previews—that is acceptable if you know why. For staging reviews, temporarily grep for launchstatic.dev absolute URLs and confirm they are intentional (canonical, OG, sitemap), not navigation hrefs that should be root-relative.

Social and footer link rot

Twitter/X URL changes, deprecated Discord invite links, and moved GitHub org repos are frequent offenders in footers. Schedule a quarterly manual click through social icons even when automated crawlers pass—some platforms return 200 to bots but interstitial login walls to humans. Replace dead Discord invites before launch day announcements; nothing signals "abandoned project" like an expired invite in the hero footer.

Assign one owner for link health in your launch retro. When multiple people edit HTML by hand, broken relative paths appear silently—grep for href="" and href="#" before every production tag.

Print the crawler output to your CI logs. A failing link check should block merge the same way a failing unit test would—prevention beats apologizing on social media for a dead pricing link.

Remember downloadable single-file templates in /downloads/ may use different relative paths than production pages—audit them separately before publishing to GitHub releases.

Treat link fixing as part of accessibility work—keyboard users follow the same hrefs mouse users click, and dead ends waste everyone's time.

Run link checks after renaming files—git does not warn you when pricing.html becomes plans.html but nav still points at the old path.

Related: Deployment checklist Generate sitemap.xml Deploy guides Templates catalog

How many broken links are acceptable?

Zero on primary navigation and CTAs. Occasional archived blog outbound failures are tolerable if fixed promptly.

Do anchor links need checking?

Yes. Broken in-page anchors frustrate users clicking feature tabs or table-of-contents links.

Should I check images too?

Absolutely. Broken hero images are as damaging as broken HTML links.

What about links in CSS url()?

Include them in manual review or advanced crawlers. Missing background fonts and images slip past href-only scans.

Ship with confidence

Start from tested LaunchStatic templates with consistent root-relative navigation.

Browse templates Build your sitemap