Redirects and rewrites
Send visitors to a new URL or serve a different route without changing the URL.
Redirects and rewrites are defined in your framework's configuration, such as
redirects() and rewrites() in next.config.js or Nuxt route rules. Easel
reads them from the build output and applies them at the edge. Where they run
relative to middleware and static files is covered in
Routing.
To send every request on one hostname to another domain, such as
example.com → www.example.com, use a
domain redirect instead.
Redirects
A redirect returns a 3xx response with a Location header, and the client
requests the new URL. Easel returns it before any route or function runs.
Use permanent redirects (301, 308) only for moves you intend to keep.
Browsers and search engines cache them.
Rewrites
A rewrite serves a different destination while the visitor's URL stays the
same. Use rewrites to map a public path to an internal route, serve a
single-page app's index.html for client-side routes, or proxy an external
origin where the framework supports it.
A rewritten response is cached by the policy on the final response. See Caching.
Rule order
Rules match in order. Put specific rules before broad catch-alls:
Keep catch-all rewrites away from asset paths, so a missing file returns 404
instead of HTML.
Verify
Inspect a redirect without following it:
A rewrite doesn't show in response headers. Open the request in Requests to see the route that handled it. Redirect loops and failing external rewrites are covered in CDN troubleshooting.