Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Back button not working: fix history hijacking and redirect loops

PRF-229High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

The browser keeps a list of pages a visitor has seen, called the history. Back moves one step down that list. The Back button is "broken" when that step does not take the visitor to where they came from.

There are three common forms of it:

Common ways the Back button gets broken
PatternWhat the visitor seesTypical cause
Redirect loop on BackBack lands on a URL that instantly sends them forward againServer or JavaScript redirect on an intermediate URL (for example /go, /lang, a http to https or trailing slash rule)
History hijackingBack keeps them on the same page, or needs many clicksScript calls history.pushState repeatedly or re-adds an entry on popstate
Forced exit or popupBack shows an offer or a different page instead of the previous oneExit-offer or 'back button redirect' scripts, some ad or affiliate tools

Why it costs you leads or sales

Visitors use Back to compare options, return to search results or correct a mistake. If it fails, they feel trapped and often close the tab. They may also lose trust in a checkout or form on the same site.

It is worst on paid traffic. You paid for the click, and the visitor cannot get back to the ad or search results to try another option, so they leave with a bad impression of your brand.

Where a redirect loop traps a visitor
  1. Ad or search resultVisitor clicks through
  2. Short redirect URLRedirects to landing page
  3. Landing pageVisitor presses Back
  4. Redirect URL againSends visitor forward instantly
  5. Back to resultsNever reached

The visitor presses Back from the landing page and is sent forward again.

Visitors who leave after Back failsExample numbers
Visitors who leave after Back fails (example)Back works: 40 %; Back loops: 10 %015314010Back worksBack loops%

Example: illustrative numbers only. Of 100 visitors who press Back, the share who stay on the site.

How to check if your site has it

Test it as a visitor first, then look at the code. Use a private window so extensions and cached redirects do not hide the problem.

Manual Back button test
  1. Start from a real entry point

    Open Google results, an ad preview link or a campaign URL with UTM parameters. Click through to your landing page.

  2. Press Back once

    You should return to where you came from. If you stay on the page, reload, or jump forward, note the URL.

  3. Repeat through the funnel

    Go landing page, form, thank-you page and checkout, pressing Back at each step. Do it on mobile Safari and Chrome too, as behaviour differs.

  4. Watch the history in DevTools

    Open the Network tab, tick Preserve log, and press Back. Look for 301, 302 or 307 responses, or a document that loads twice.

  5. Search the code for history calls

    Search your theme, tag manager and scripts for pushState, replaceState, popstate, location.replace and location.href.

Check a URL for redirects from the command linebash
curl -sIL -o /dev/null -w '%{url_effective} %{num_redirects}\n' https://example.com/go
# More than 1 redirect, or a chain that returns to an earlier URL, is worth investigating

How to fix it

The fix depends on the cause. A redirect that is meant to run once should replace the entry in history, not add one. A script that pushes history entries should be removed.

Fix the cause
  1. Identify the trapping URL or script

    Use the Network log and code search from the check above. Note which URL redirects and which file calls the history API.

  2. Remove history hijacking scripts

    Delete any code that pushes a dummy entry on load or re-pushes on popstate. Disable exit-offer or 'back redirect' tools in your plugins or tag manager.

  3. Make redirects server-side and single-hop

    Use one 301 or 302 straight to the final URL. Avoid chains and avoid JavaScript redirects with location.href, which add a history entry.

  4. Replace instead of push where a client redirect is needed

    Use location.replace(url) so the redirecting page is not left in history.

  5. Keep the Back-visible URL stable

    Do not redirect visitors away from a URL they can reach with Back, such as language or country redirects that ignore their choice. Save the choice and respect it.

Client redirect that does not break Backjavascript
// Adds a history entry, so Back returns to the redirecting page and loops:
// window.location.href = 'https://example.com/landing';

// Replaces the current entry, so Back skips the redirecting page:
window.location.replace('https://example.com/landing');
Where to look on your platform
  1. Check redirect plugins

    Review Redirection, Rank Math or Yoast redirects and any language or geo plugin for rules that point back to the previous URL. Remove loops.

  2. Disable popup and exit plugins

    Deactivate popup, exit-intent and 'back button' plugins one by one, testing Back each time.

  3. Check the https and www setting

    Under Settings > General make sure the WordPress and Site Address URLs match the version your server and CDN redirect to.

How to confirm it's fixed

Confirmation checks
  • From a Google result or campaign link, Back returns to the source in one click
  • From the landing page, form and thank-you page, Back goes to the previous step
  • The Network log shows no repeated redirects after pressing Back
  • curl -sIL shows one redirect at most for old URLs
  • Back works on desktop Chrome, mobile Safari and mobile Chrome
  • Back works with and without a UTM-tagged URL

How to prevent it happening again

Prevention habits
  • Add a Back button test to your launch checklist for every new landing page and funnel
  • Retest after installing or updating popup, redirect, language or A/B testing tools
  • Review redirect rules whenever you change URLs, domains or https settings
  • Ask for code review of any script that touches history or location
  • Keep a list of all redirects so you can spot loops
  • Never use scripts that deliberately block Back

How FunnelGuard handles this

FunnelGuard does not check the Back button yet. It is a possible future check, so you cannot rely on FunnelGuard to tell you when history is hijacked or a redirect loops on Back.

What FunnelGuard does do is run your real customer journeys (lead forms, checkouts, booking and chat buttons) on a schedule from the EU or the US. It checks each step, the tracking hits sent to ad and analytics platforms, and whether test leads reach your inbox and CRM. A redirect loop on a forward step can make a journey fail, and that failure is re-checked from a second region before one alert goes out. But that is a broken forward journey, not a Back button test.

To watch for Back problems today, add the manual test above to your release routine and retest after plugin or redirect changes. You can also use browser DevTools or a site crawler to find redirect chains and loops. A free read-only website audit from FunnelGuard is available, and the Free plan covers 1 site and 2 journeys with daily checks and no card.

Questions people ask

Why is my website's back button not working?

Usually a redirect sends the visitor forward again, or a script adds extra entries to the browser history with history.pushState. Test in a private window, check the Network log for repeated redirects, and disable popup, exit-offer and redirect plugins one by one.

How do I fix a redirect loop when I press Back?

Find the URL that redirects and make it a single server-side redirect straight to the final page. If JavaScript does the redirect, use location.replace() instead of location.href so the redirecting page is not saved in history.

What is back button hijacking?

Back button hijacking is when a site manipulates the browser history so Back does not return the visitor to the previous page. It may keep them on the same page, send them elsewhere or show an offer. It is deceptive and should be removed.

Can a plugin break the Back button on WordPress or Shopify?

Yes. Popup, exit-intent, geo or language redirect, and A/B testing tools can add redirects or history entries. Disable them one at a time and test Back after each to find the culprit.

Why does Back take me to the same page again?

The page probably pushes a new history entry on load, or the previous URL redirects to the current one. Check for pushState calls and for a redirect on the URL before it in the Network log.

Does a broken back button hurt SEO?

It can. Visitors who cannot return to search results leave unhappy, and Google has said it treats back button hijacking as a spam practice. Check Google's current spam policies and remove any such scripts.

Does FunnelGuard monitor the Back button?

Not yet. It is a possible future check. FunnelGuard does run your key journeys on a schedule and checks each step, tracking hits and lead delivery, so a redirect problem that breaks a forward step may show up as a failed journey.

How do I test the Back button on mobile?

Open the site on a real phone in Safari and Chrome, start from a search result or ad link, and press Back at each funnel step. Mobile browsers handle history differently, so desktop testing alone can miss problems.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: back_button_works (Stage 29): after the run, opens two journey pages and presses Back; a history trap fails.

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.