Nginx Redirect Generator

Generate Nginx redirect snippets for moved pages, HTTPS upgrades, and canonical host cleanup.

Nginx redirect snippet

        

How to use this tool

  1. Enter the old path and destination path or URL.
  2. Choose 301 for permanent redirects or 302 for temporary redirects.
  3. Add HTTPS or www to non-www snippets only when they match your server block.
  4. Run nginx -t before reloading Nginx.

Common mistakes

  • Adding return rules to the wrong server block.
  • Forgetting to test with nginx -t before reload.
  • Creating a redirect loop between CDN, app, and Nginx rules.

FAQ

Where do I paste the Nginx snippet?

Usually inside the relevant server block. Host-level redirects may need their own server block.

How do I test a redirect?

Use curl -I https://example.com/old-path and check the Location header.

Is this production ready?

It is a starter snippet. Review it against your server block before production.

Related tools

Related guides and fixes

Last updated: May 17, 2026