Netlify _redirects Generator
Easily create rules for your Netlify _redirects file including proxying APIs, SPA fallbacks, and JWT role-based access.
Netlify _redirects Generator
Generate syntax-perfect _redirects files for your Netlify deployments. Handle SPAs, API proxies, and role-based redirects with ease.
_redirects Output
Deployment Notice
Save this content in a plain text file named exactly _redirects (no extension). It must be placed in your site's publish directory (usually public or dist).
How does the _redirects file work?
Netlify uses a very simple plain-text file called _redirects (no file extension) in the root of your published directory (usually public/, dist/, or build/ depending on your framework).
The syntax is always: /old-path /new-path [status-code] [options]
Common Status Codes:
- 301: Permanent redirect. Updates search engines. (Default if none is specified).
- 302: Temporary redirect.
- 200: Rewrite. Keeps the URL the same in the user's browser but serves content from the new path. Used for proxying APIs or SPA fallbacks.
- 401: Unauthorized. Used for redirecting unauthenticated users using Netlify Identity or JWTs.
What is forcing (!) ?
By default, if a static file exists at the requested path, Netlify will serve the static file and ignore the redirect rule. If you append a ! to the status code (e.g. 301! or 401!), Netlify will execute the redirect even if a file exists at that path. This is crucial for protecting static files behind Role-Based Access Control.
Related Guides
Deepen your understanding with our expert articles.
