Homeglossary

URL Redirect

A URL redirect is a web routing mechanism that sends a browser or search engine from a requested URL to a different destination URL. It is commonly used when a page moves, a domain changes, or an application needs to send users to a sign-in, checkout, or callback page. The redirect type signals whether the move is temporary or permanent and can affect browser behavior, request handling, and search visibility.

Build redirect-ready web apps with Emergent.

What Is a URL Redirect?

A URL redirect sends a browser or search engine from one URL to another. Also called URL forwarding, it helps when a page moves, such as sending /old-pricing to /pricing instead of an error page.

How a URL Redirect Works

Most redirects are handled by the web server before it sends page content.

  1. A browser, app, or search crawler requests the source URL.
  2. The server responds with a 3xx HTTP status code and a Location header containing the destination URL.
  3. The client requests the destination URL.
  4. The destination server returns the page or application response.

Browser-side redirects, including JavaScript and meta refresh, run after HTML reaches the browser. Server-side redirects are usually more reliable for moved pages.

URL Redirect Types: 301, 302, 307 and 308

The status code indicates whether a move is permanent and how requests should be repeated.

CodeMeaningMethod behavior
301Permanent move, often cached by browsers.Older client behavior can change POST to GET.
302Temporary move.Some clients may change POST to GET.
307Temporary move.Preserves the request method and body.
308Permanent move.Preserves the request method and body.

Method preservation matters for forms and APIs. A 307 or 308 can repeat a POST request, so its destination must safely accept it.

When to Use a URL Redirect

Use redirects to keep links and application routes working through change.

  • Move a page, migrate a site, or change a canonical domain.
  • Send HTTP traffic to HTTPS.
  • Replace retired content with the closest relevant page.
  • Return a signed-in user to the page they requested.
  • Receive an OAuth response at a registered callback URL.

Benefits of URL Redirects

Well-planned redirects make URL changes less disruptive.

  • They preserve bookmarks and inbound links.
  • They reduce dead ends for visitors and crawlers.
  • They guide crawlers to replacement content.
  • They support navigation across changing app routes.

Limitations and Risks of URL Redirects

A redirect is not automatically safe or correct.

  • Loops send a client back and forth until it fails.
  • Chains add hops and slow navigation.
  • Unrelated destinations create a poor experience.
  • A cached permanent redirect can be hard to reverse quickly.
  • An open redirect lets an untrusted URL parameter choose the destination, aiding phishing. Unexpected redirects may also signal a malicious extension or compromised site.

URL Redirect Best Practices and Testing

Treat redirects as a tested part of a release, especially during a migration.

  • Map each old URL to the closest relevant new URL.
  • Prefer one server-side hop and update internal links directly.
  • Keep query parameters only when useful and safe.
  • Test the status code, final destination, and GET and POST behavior.
  • Monitor errors after launch. A URL shortener is a related routing tool, but check its final destination.

URL Redirects in Emergent Apps

In web applications, redirects commonly support route changes, sign-in return paths, deployed domains, and third-party callbacks. With Emergent's AI web app builder, teams can describe, build, test, and verify these flows after deployment.

Start Building
on Emergent today
Start Building