Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Production pages linking to staging URLs: how to find and fix

SEO-303Medium impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

A staging site is a private copy of your website where you test changes before they go live. When you move that copy to production (the live site), any address saved with the staging hostname moves with it. Examples are https://staging.example.com/pricing/ or https://example.stage-host.io/contact/.

Why it costs you leads or sales

Staging is usually password-protected, blocked or deleted later. A visitor who clicks a staging link on a live page can land on a login prompt, a 403 error or a 404. If that link is your pricing, booking or checkout button, the lead is gone.

How a staging link loses a lead
  1. Visitor lands on live pagewww.example.com/services
  2. Clicks Book nowLink still points to staging.example.com/book
  3. Password wall or errorPage blocked, 403 or 404
  4. Booking madeNever reached

The live page looks fine until the visitor clicks the link that still points to staging.

Clicks that end on a working pageExample numbers
Clicks that end on a working page (example)Button links to staging: 0 %; Button links to production: 100 %038770100Button links to stagi…Button links to produ…%

Example: of 100 clicks on a button, a staging link sends every one to a dead end, while a fixed link sends them to the live page. Numbers are illustrative.

How to check if your site has it

You are looking for your staging hostname anywhere in what the live site serves. Work from the outside in: view source first, then crawl, then search the database.

Find staging URLs on the live site
  1. Note the exact staging hostname

    Copy it from your host or agency, for example staging.example.com. Also note any temporary host the developer used, such as a preview or dev subdomain.

  2. Search the page source

    Open your key pages (home, pricing, contact, checkout), choose View page source, and search for the staging hostname. Check links, image and script sources, canonical and og:url tags.

  3. Crawl the live site

    Run a crawler such as Screaming Frog and use its custom search for the staging hostname in the HTML. Also look at the outlinks report for any link whose host is not your production domain.

  4. Check the sitemap and robots.txt

    Open /sitemap.xml and /robots.txt and look for the staging hostname in URLs or the Sitemap line.

  5. Search Google

    Search site:staging.example.com to see whether staging pages are indexed, and check Search Console for external or internal links to that host.

  6. Check forms and embeds

    Inspect form action attributes, iframes, booking widgets and thank-you page redirects, since these often store absolute URLs.

Quick command-line check of a live pagebash
curl -s https://www.example.com/ | grep -o 'https\?://[^"\' )]*staging[^"\' )]*' | sort -u

How to fix it

The principle is the same everywhere: replace the staging hostname with the production one, and prefer relative links where the platform allows. The place to edit depends on your platform.

Replace staging URLs by platform
  1. Back up the database

    Take a full backup before any bulk change.

  2. Check the site address

    Go to Settings > General and confirm WordPress Address and Site Address use the production domain.

  3. Search and replace

    Use WP-CLI: wp search-replace 'https://staging.example.com' 'https://www.example.com' --dry-run, then run it again without --dry-run. WP-CLI handles serialized data safely. A search-replace plugin that supports serialized data also works.

  4. Check builders and SEO plugin

    Clear the cache of your page builder (for example regenerate Elementor CSS) and your caching plugin. Check canonical and sitemap settings in your SEO plugin.

WordPress: preview then run the replacementbash
wp search-replace 'https://staging.example.com' 'https://www.example.com' --all-tables --dry-run
wp search-replace 'https://staging.example.com' 'https://www.example.com' --all-tables
wp cache flush

How to confirm it's fixed

Confirm checklist
  • Page source of home, pricing, contact and checkout pages contains no staging hostname.
  • A fresh crawl shows no links, images, scripts or canonicals on the staging host.
  • Canonical and og:url tags use the production domain.
  • sitemap.xml and robots.txt list production URLs only.
  • Form actions, redirects and thank-you pages land on the live site.
  • Caches (plugin, CDN, browser) have been cleared before you test.

How to prevent it happening again

Most cases come from a copy of staging being pushed to live without a rewrite step. Make the rewrite part of the launch process.

Launch routine
  • Add a search for the staging hostname to your pre-launch and post-launch checklist.
  • Run the search-replace or config change as a scripted step, not a manual one.
  • Use relative links or environment variables for the base URL.
  • Keep staging password-protected and set to noindex, and remove those only on production as intended.
  • Re-crawl the live site within a day of every launch or migration.

How FunnelGuard handles this

FunnelGuard detects this only partly. When it runs your journey, it can check that a page does not contain given text, and that text check can match a staging hostname. If you add the staging hostname as text that must be absent on a step, the check fails when the page content includes it.

Questions people ask

Why does my live website link to the staging site?

The staging hostname was saved as a full URL in your content, theme, builder or settings, and it was copied to production without being rewritten. Search your live HTML and database for the staging hostname and replace each match with your production URL.

How do I find staging URLs on my live site?

View the page source of key pages and search for the staging hostname, then crawl the site with a tool such as Screaming Frog using a custom search. Also check sitemap.xml, robots.txt, form actions and, on WordPress, the database.

How do I replace staging URLs with live URLs in WordPress?

Back up the database, then run wp search-replace with the staging and production URLs, using --dry-run first. WP-CLI handles serialized data safely. Afterwards clear your cache and page builder CSS.

Can staging links hurt my SEO?

Yes. A canonical tag pointing to staging asks Google to prefer the staging page, and internal links to staging send crawlers to a URL you do not want ranked. Dead staging links also give visitors a poor experience.

Will Google index my staging site if my live pages link to it?

It can. Links give crawlers a route in, and if staging is not password-protected or set to noindex, its pages may be indexed. Protect staging with a password and fix the links.

Why are images on my live site loading from the staging domain?

The image URLs were stored as absolute staging addresses in the content or theme. Replace them with production or relative URLs, then purge caches. If staging goes offline, those images will break.

Can FunnelGuard detect staging links on my live site?

Partly. A text-absent check on a monitored page can match a staging hostname and fail if it appears. It does not crawl your whole site, so pages outside your journeys need a manual crawl.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: text_absent can match staging hostnames.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.