Meta Refresh vs. HTTP Redirects: Which Should You Use?

Compare HTTP redirects, meta refresh, and JavaScript navigation, and learn which method to use for page moves, accessibility, and search visibility.

Published
Reading time
7 min read
Meta Refresh vs. HTTP Redirects: Which Should You Use?
On this page

When you move a page, the choice between a meta refresh and an HTTP redirect affects when visitors and crawlers reach the new URL. In most permanent or temporary page moves, an HTTP redirect is the clearest choice. Meta refresh and JavaScript navigation are alternatives when you cannot control the server response or need behavior within the page.

Key Takeaways

  • Use an HTTP redirect for most page moves: it tells the browser and crawler where to go before the old page renders.
  • Use a temporary HTTP redirect while testing or when the move is genuinely temporary; use a permanent redirect once a lasting move is confirmed.
  • Meta refresh is an HTML fallback, not an equivalent server-side response. A delay can interrupt users and assistive technology.
  • JavaScript navigation requires JavaScript to run. For a user-initiated move, a normal link is usually simpler and more reliable.

Meta refresh vs redirect: what happens and when?

MethodWhere it is implementedWhen navigation startsMain dependency
HTTP redirectServer, hosting platform, CDN, or application responseAfter the client receives a redirect status and Location headerThe redirect response must reach the client
HTML meta refreshA <meta> element in the page's HTML <head>After the HTML is received and processed, immediately or after a delayThe client must process the HTML refresh instruction
JavaScript navigationA script in or loaded by the pageWhen the script executesJavaScript must be available and the script must run successfully

For example, a server can respond to a request for /old-page with a redirect status and a Location: /new-page header. With a meta refresh, the server usually sends an HTML page first, and the browser processes an instruction inside it. With JavaScript, the page must run code that changes the location.

None of these methods guarantees that every crawler or client will follow the destination. Check the behavior of the clients that matter to your site.

Advertisement

Which method fits your move?

SituationRecommended approachWhy
Permanent page moveHTTP 301 or 308Communicates a lasting move without requiring the old page to render.
Temporary page moveHTTP 302 or 307Communicates that the original URL may be used again.
User chooses to navigateAn ordinary HTML linkGives the user control and works without JavaScript.
No control over HTTP responsesImmediate meta refresh, with a visible linkA fallback when the hosting environment only lets you edit HTML.
Navigation depends on an interaction or client-side stateJavaScript, with a suitable link or other fallbackUseful when navigation requires application logic, but dependent on script execution.

For ordinary page requests, 301 and 302 are common choices. If preserving the request method and body matters—for example, when redirecting a form submission—consider 308 for a permanent move or 307 for a temporary move. Some clients can change a POST to a GET after a 301 or 302. Choose deliberately and test the actual form flow; don't redirect submitted data to an unintended destination.

A 303 is another option after a form submission when the intended next step is a GET request for a result page. That is a different purpose from preserving the original request.

Implement an HTTP redirect

If you control the web server, configure the redirect where the old URL is handled. This Nginx example permanently moves one exact path:

location = /old-page {
    return 301 /new-page;
}

Place the location block inside the appropriate server block, check the configuration with nginx -t, and reload Nginx using your environment's normal procedure. Test on a staging site first. If a CDN or hosting platform handles requests before Nginx, its rules and caches can affect what visitors receive.

You can use a temporary status while validating a move, then switch to a permanent status when appropriate. Permanent redirects can be cached, so correcting a mistaken destination may not immediately update every client.

This example matches only /old-page; decide separately how to handle trailing slashes, query parameters, and other old URLs. If query parameters carry meaningful state, verify the resulting destination rather than assuming a particular server configuration preserves or transforms them as intended.

Use meta refresh only when you need the HTML fallback

If your host lets you edit the old page but not its HTTP response, an immediate meta refresh can point visitors to the replacement:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Page moved</title>
  <meta http-equiv="refresh" content="0; url=/new-page">
</head>
<body>
  <p>This page has moved. <a href="/new-page">Open the new page</a>.</p>
</body>
</html>

The 0 requests an immediate refresh. The visible link provides a way forward for clients that do not follow it. A delayed refresh can leave someone reading or navigating the page when it suddenly changes; that can be especially disorienting for people using screen readers, magnification, or other assistive technology. If the user needs to read a message or choose when to leave, prefer a normal link rather than a timed transition.

For search visibility, Google has historically distinguished immediate from delayed meta refreshes when interpreting redirect signals. This article could not consult current Google Search Central guidance or current accessibility recommendations, so check those sources before relying on a specific search or compliance interpretation. An HTTP redirect remains the more direct way to communicate a page move.

Advertisement

Use JavaScript for application-driven navigation

A normal link is the best starting point when a visitor chooses to open another page:

<a href="/new-page">Open the new page</a>

When an application must navigate after running client-side logic, JavaScript can change the current location:

<p>This page has moved. <a href="/new-page">Open the new page</a>.</p>
<script>
  window.location.replace('/new-page');
</script>

replace() replaces the current history entry rather than adding a new one, which can help prevent the Back button from returning to a page that immediately navigates away again. The link remains available if the script is disabled, blocked, or fails to run.

JavaScript redirects can be missed or delayed by clients that do not execute scripts, including some crawlers and link-checking tools. They also cannot communicate a redirect in the original HTTP status. Avoid making JavaScript the only route to essential content when a server redirect or link is available.

Check the result

After deployment, request the old URL and inspect the status and Location header. Replace the example URL with a page on a site you control:

curl -sS -D - -o /dev/null https://example.com/old-page

For the Nginx example, expect a 301 response with a Location pointing to /new-page or its equivalent absolute URL. To follow the chain and see the final URL and status:

curl -sS -L --max-redirs 10 -o /dev/null \
  -w 'Final URL: %{url_effective}\nFinal status: %{http_code}\n' \
  https://example.com/old-page

Check that the final page returns the expected content, that there is no loop, and that the chain has no unnecessary hops. Test representative URLs, including relevant query strings, in a browser as well. curl does not execute page JavaScript and this command is not a browser test of meta refresh, so inspect the HTML and test those approaches separately.

Common Mistakes

  • Using a delayed refresh as a message screen. Users may not have enough time to read or operate the page. Let them choose a link instead.
  • Assuming a 200 OK page with a redirect script is an HTTP redirect. The navigation instruction is in the content, not the response status and Location header.
  • Using a permanent status before the destination is settled. Cached redirects can make mistakes harder to undo.
  • Ignoring forms and request methods. A redirect suitable for a page GET may not be suitable for a POST.
  • Removing the old URL too soon. Existing links and bookmarks still need a working response at that address.
  • Sending every old URL to an unrelated homepage. Point each moved page to its relevant replacement where possible.

Best Practices

Keep redirect chains short, update internal links to the final destination, and check both the old and new URLs after changes to hosting or CDN rules. Test with JavaScript disabled when a page relies on client-side navigation. For accessibility and search decisions, consult the current primary guidance and test the actual user experience; a redirect mechanism alone does not establish compliance or guarantee indexing.

Conclusion

For most website moves, choose an HTTP redirect with a status that matches the move and request behavior. Use meta refresh when server-level control is unavailable, and reserve JavaScript navigation for cases that genuinely need client-side logic. Provide a normal link whenever users need to choose when to navigate.

What would your domain sell for?

A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.