Redirects and Rewrites

A redirect tells the client or browser to use another URL. A rewrite maps one URL to another destination without necessarily changing the visible browser URL.

Redirects are useful when a resource has moved or authentication requires navigation to a login page. Rewrites can be useful for proxying or creating clean public URLs over internal paths.

Choose between them based on whether the browser should know that the URL changed.

Key Takeaways
  • Redirects change navigation.
  • Rewrites can preserve the visible URL while changing the destination.
  • URL behavior should be predictable and documented.