Home / Blog / Link audits
Link audits

What is the best way to find staging and localhost URLs left behind on a live site?

Staging and localhost addresses survive launches in places a normal broken link report never looks. This is the sweep we run to find every one of them, and the setup that stops them coming back.

An empty theater stage lit by a single bare work light on a metal stand, rows of empty red seats in the foreground, dust visible in the beam

Where staging addresses actually hide

Visible links are the easy part and rarely the whole story. Editors paste absolute addresses while a site is still on staging, page builders store full URLs inside serialized settings, and imported content arrives carrying the hostname of wherever it came from. Beyond the obvious href, staging hosts turn up in canonical tags, hreflang alternates, sitemap entries, RSS and JSON feeds, Open Graph and structured data image fields, srcset attributes, inline CSS background images, form action attributes, and configuration compiled into a JavaScript bundle months ago.

Localhost has its own variety: addresses pointing at a developer machine, loopback IPs, .local or .test hostnames from someone's local environment, and temporary preview domains from a hosting platform. Those come from documentation examples, seeded demo content that survived launch, and copy paste from a terminal into a CMS field at eleven at night. They tend to sit deep in the site, on old posts and internal help pages nobody has opened in a year, which is precisely the territory where a full crawl earns its keep. Related: When to Run a Full Link Audit

Keep reading: When to Run a Full Link Audit, How a Site Crawl Actually Works, Reading a Redirect Chain Map. See how DeadLinkr helps you on demand link and redirect audits for seo.

Staging is usually protected by basic authentication or an IP allowlist, so a link to it does not fail cleanly. Instead of a 404 it returns a 401, a 403, or a timeout, and the visitor gets a password prompt apparently coming from your brand, which reads as a security problem rather than a maintenance one. The alternative is worse. If staging is not protected, the link works, and you have just handed a stranger unreleased pricing, draft copy, or a checkout wired to a test payment gateway.

Then there is the indexing damage. A canonical tag pointing at a staging host tells search engines the real page is a copy of an address they either cannot reach or should never have seen. Sitemaps listing staging URLs invite crawling of a site you never meant to publish. Mixed content is a third failure mode, where an http address on an https page gets blocked or upgraded depending on the browser. Each of these breaks differently, and none of them looks like a plain dead link in a report sorted by status code.

A sweep that actually finds all of them

Start from the outside, with a crawl of the live site, and change what you are looking for. Instead of collecting failures, collect hostnames. Build an allowlist containing the production domain, its legitimate subdomains, your CDN, and the third parties you actually use, then list every host that is not on it. That one view surfaces staging, localhost, an old domain from a rebrand, and an agency preview server in a single pass, and it works whether or not the link happens to be broken today. Related: How a Site Crawl Actually Works

Then go inside. Search the content store for the staging hostname, including variants with and without the protocol and with and without www. Where a platform keeps serialized settings, use tooling that understands the format instead of a plain find and replace, because a naive substitution changes the string but leaves the recorded length wrong and corrupts the record. Grep the build output and template files separately, check the sitemap and feeds on their own since they are generated rather than authored, and finally look for indexed pages sitting on the staging host. Related: Auditing a Large Site Without Missing Pages

Making it stick after launch

The durable fix is to stop storing absolute internal addresses at all. Root-relative links, meaning /pricing rather than the full https address, move between environments untouched and remove this entire class of problem for anything an editor writes. For URLs generated by code, read the base address from an environment variable so the same build produces correct links everywhere it runs. Where a page builder insists on storing absolute URLs, run the environment-aware replacement as a documented deploy step instead of a manual afternoon someone repeats badly.

Protect staging so that a leaked link fails safely rather than embarrassingly: authentication on every response, a noindex header set by configuration rather than a file someone remembers to edit, and a robots policy that follows the environment. Then add one recurring check. An audit rule that alerts whenever a hostname outside your allowlist appears on a live page costs almost nothing to run monthly, and it will catch the post an editor drafts on staging six months from now, long after this launch has been forgotten. Related: A Pre Launch Link Checklist

Key takeaways
  • Staging addresses hide well past visible links, in canonicals, sitemaps, feeds, structured data, srcset, and compiled bundles.
  • They surface as 401s, timeouts, or pages that quietly work, so a report sorted by broken status codes misses them.
  • Audit by hostname rather than by failure: allowlist production plus known third parties, then list everything else.
  • Root-relative links and an environment-driven base URL prevent it, and a monthly hostname check catches the rest.
Julien Jimenez
Written by

Julien Jimenez

Julien Jimenez is an independent software builder based in Paris. He designs, ships, and operates focused SaaS products for small businesses and independent professionals. Read the full author page.

A deep link audit whenever you need one

On demand link and redirect audits for SEO. DeadLinkr is built to help you put this into practice.

Run an audit

More from the DeadLinkr blog

Get the DeadLinkr playbook

Practical guides on link audits, straight to your inbox as we publish them. No spam, unsubscribe any time.

By subscribing you agree to our privacy policy.