Nginx Redirect Generator
For a long list the tool writes a map table (hash lookup, no regex); for a few pages, location blocks. It also writes the server blocks for HTTPS, www and domain moves.
Privacy and cost
This tool runs in your browser. What you type or paste is not sent to our servers and it costs nothing to use.
How it works
- Pick the mode: pages and folders, HTTPS / www / trailing slash, or a domain move.
- Paste the list or enter the domains, then choose map or one location per rule.
- Put the map block in the http context and the rest in the labelled server block, test with nginx -t and reload.
Example
For "/old-page /new-page" the map mode writes the keys "/old-page" and "/old-page/" pointing to "/new-page", followed by an if that runs return 301 and keeps the query string. For example.com with HTTPS and www, one block listens on port 80 for "example.com www.example.com" and returns return 301 https://www.example.com$request_uri.
What the result means
Nginx does not read .htaccess: redirects live in the server configuration. A map compares the exact path and stays fast with thousands of lines. Folder and query-string rules use if followed by return, the safe use of if. Values are quoted and the $ sign in targets is encoded so it cannot become a variable.
Common problems this tool helps with
- A map must be declared in the http context, not inside server, or nginx -t fails.
- Two identical keys in a map stop nginx at startup; the tool removes duplicates.
- A trailing slash removed on a real directory loops with nginx's automatic slash unless the -d guard is there.
- Rules with a host name belong in that host's server block, not in a global map.
Frequently asked questions
return 301 or rewrite?
return is simpler and faster for a redirect: nginx answers straight away. rewrite ... permanent is for reusing part of the path with a regex, but it only knows 301 and 302.
Do I need many rules to use a map?
No, but it pays off from a few dozen lines. Beyond a hundred entries the tool adds map_hash_max_size and map_hash_bucket_size.
Where do the certificates come from?
The 443 blocks contain sample ssl_certificate paths. Replace them with your own files (Let's Encrypt, your host…).
Is my data sent anywhere?
No, generation runs in your browser.
Related tools
- Redirect Rule GeneratorOne list, six output formats. The tool checks every line, flags loops, duplicates and chains, then writes the syntax each platform expects.Free · runs in your browser
- Apache .htaccess Redirect GeneratorThree modes: page-by-page redirects, site hygiene (HTTPS, www, trailing slash) and a move to a new domain. Patterns are escaped for you.Free · runs in your browser
- Cloudflare Redirect Rule GeneratorCloudflare offers two ways to redirect: one rule per redirect (Single Redirects) or a list of exact URLs (Bulk Redirects). The tool writes both, plus a few common presets.Free · runs in your browser
- Redirect Chain CheckerPaste a URL to see every redirect it goes through before the final page, with the status code and timing of each hop.Free account · 3 live checks/day
- Canonical Tag GeneratorPaste a page URL: the tool cleans it (https, tracking parameters, fragment, index file, trailing slash) and outputs the canonical tag and the HTTP header.Free · runs in your browser
- URL Parameter RemoverPaste your URLs and strip tracking parameters (utm_*, gclid, fbclid…) or any names you choose in one go, leaving everything else untouched.Free · runs in your browser