Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Meta refresh or JavaScript redirect instead of 301: how to fix it

SEO-086Medium impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

A redirect sends visitors from one URL to another. A proper redirect happens on the server: the server answers the request with a status code such as 301 (moved permanently) and a Location header. The browser or crawler never sees the old page.

A meta refresh or JavaScript redirect works differently. The server returns a normal 200 OK page. Then the page itself tells the browser to move on, using a <meta http-equiv="refresh"> tag or code like window.location.href = .... The old URL still looks like a real, live page.

Two patterns to look forhtml
<!-- Meta refresh -->
<meta http-equiv="refresh" content="0; url=https://example.com/new-page/">

<!-- JavaScript redirect -->
<script>
  window.location.href = "https://example.com/new-page/";
</script>

Why it costs you leads or sales

Google says it can follow both methods, but it treats a server-side redirect as the clearest signal for a permanent move. A page-level redirect has to be fetched, and for JavaScript it may need rendering first. That can delay the new URL being picked up, and other crawlers and AI tools that do not run JavaScript may never follow it.

There are visitor costs too. People see a blank or flashing page before the jump. Back-button behaviour can trap them in a loop. Ad and analytics tags on the old page may fire, or not fire, before the jump, and query strings such as gclid or UTMs can be dropped if the script does not copy them across. That muddies attribution and wastes ad spend.

How a JavaScript redirect can lose a visit
  1. Ad or search clickVisitor lands on the old URL with UTMs or gclid
  2. Old page loads (200)Server does not redirect
  3. Script redirectsQuery string not copied
  4. New pageSource of the visit unknown

The old URL answers 200, so crawlers may index it, and tracking details can be lost in the jump.

Visits with a known source after a redirectExample numbers
Visits with a known source after a redirect (example)Server-side 301 keeping query: 95 %; JS redirect that drops query: 40 %036739540Server-side 301 keepi…JS redirect that drop…%

Example: illustrative numbers only, showing how dropped parameters can reduce attributed visits.

How to check if your site has it

Find page-level redirects
  1. Test the old URL with curl

    Run curl -I https://example.com/old-page/. A real redirect shows 301 and a location: header. If you see 200 OK, the move is happening in the page, not the server.

  2. View the page source

    Open the old URL, choose View Source, and search for http-equiv="refresh", window.location, location.replace and location.href.

  3. Crawl your site

    Tools such as Screaming Frog have a meta refresh and JavaScript redirect filter. Google Search Console's URL Inspection tool shows the rendered page and the page Google picked as canonical.

  4. Check landing pages used in ads

    Open each ad destination URL in a private window. If the address bar changes after the page appears, a page-level redirect is likely.

What a good and a bad response look likebash
# Good: server-side redirect
HTTP/2 301
location: https://example.com/new-page/

# Bad: page loads, then redirects in the browser
HTTP/2 200
content-type: text/html

How to fix it

The goal is the same everywhere: remove the meta refresh or script, and add a real 301 from the old URL to the new one. Keep the query string, and point straight to the final URL.

Set a 301 on your platform
  1. Remove the old redirect

    Check the page's custom HTML, theme header and any plugin that injects a refresh tag or script, then delete it.

  2. Add a 301

    Use a redirect plugin (such as Redirection) or your SEO plugin's redirect manager. Choose type 301 and enter the old and new paths.

Apache (.htaccess): 301 that keeps the query stringhtaccess
Redirect 301 /old-page/ https://example.com/new-page/
nginx: 301 that keeps the query stringnginx
location = /old-page/ {
  return 301 https://example.com/new-page/$is_args$args;
}

How to confirm it's fixed

Confirm the fix
  • curl -I on the old URL returns 301 and a location header
  • The old URL no longer contains a refresh tag or redirect script in its source
  • The redirect lands on the final URL in one hop, with no chain
  • A test URL with ?utm_source=test&gclid=abc still has those parameters after the redirect
  • Search Console URL Inspection shows the new URL as the Google-selected canonical over time
  • Internal links and the sitemap point to the new URL

How to prevent it happening again

Agree one rule with your team: permanent moves are always set in the server or platform redirect tool, never in page code. Add a redirect check to your launch and migration checklists. Re-crawl after theme changes, new landing page builders and plugin updates, since these are common sources of injected scripts. Update internal links and the sitemap so they point at the new URL directly.

How FunnelGuard handles this

FunnelGuard does not check for meta refresh or JavaScript redirects yet. It is a possible future check. Today it runs your real customer journeys, such as lead forms and checkouts, on a schedule and checks each step and the tracking hits sent to platforms like GA4, Google Ads and Meta. If a page-level redirect breaks a journey or stops a tracking hit from firing, that failure can show up in those journey checks, but FunnelGuard does not identify the redirect type as the cause.

To watch for this issue, run a crawler such as Screaming Frog after each release and filter for meta refresh and JavaScript redirects. Also spot-check your top ad landing pages with curl -I, and review the Pages and Page indexing reports in Google Search Console. A free FunnelGuard account covers 1 site and 2 journeys with daily checks if you want to monitor the journeys behind those pages.

Questions people ask

Is a meta refresh redirect bad for SEO?

It is weaker than a 301. Google can follow a meta refresh, especially an instant one, but a server-side 301 is the clearest signal for a permanent move. Other crawlers may not handle it as well, so use a 301 where you can.

Does Google follow JavaScript redirects?

Yes, Google can follow them, but only after it renders the page, which can delay processing. Crawlers and AI tools that do not run JavaScript may not follow them at all. A server-side 301 avoids this risk.

How do I replace a meta refresh with a 301 redirect?

Remove the <meta http-equiv="refresh"> tag from the old page. Then add a 301 in your server config, CMS or platform redirect manager that points the old URL to the new one. Test it with curl -I to confirm a 301 status.

How can I tell if a redirect is a 301 or a JavaScript redirect?

Run curl -I on the old URL. A 301 status with a location header means a server redirect. A 200 status means the page loaded and any move is happening in the page, through a refresh tag or script.

Do JavaScript redirects drop UTM parameters and gclid?

They can. If the script sets a new URL without copying the query string, UTMs and gclid are lost. A server-side 301 can keep them when you pass the query string through, as in the nginx example above.

Does FunnelGuard detect meta refresh or JavaScript redirects?

No. FunnelGuard does not check for this yet, though it is a possible future check. You can find these redirects with a crawler like Screaming Frog, curl, or Google Search Console.

Is it ever okay to use a JavaScript redirect?

Yes, for behaviour tied to user actions, such as sending someone after login or form submission. For permanent URL moves, use a server-side 301.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

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.