Nginx Redirect Generator
Runs in your browser — your data is never uploaded.
Paste a list of old and new paths and get nginx configuration. Two output styles, because they are not interchangeable at scale: exact location blocks read well for a handful of rules, while a map block is a hash lookup that costs the same for ten thousand redirects as for one. The same parser backs the Apache version of this tool, so a migration list produces matching rules for either server.
0 characters · runs entirely in your browser
How to use Nginx Redirect Generator
- 1
Paste your pairs, one per line: old path, a space, then the new path or full URL.
- 2
Pick location blocks for a short list or a map block for a long one.
- 3
Click “Generate”, add to your server config, then run nginx -t before reloading.
Share
Embed this tool on your site
Paste this where you want the tool to appear. It runs entirely in your visitor's browser — no uploads, no account, no tracking.
Please keep the attribution line — it's what keeps these tools free.
Need a different size, a dark theme, or a different tool? Build an embed lets you preview it first.
Frequently asked questions
location blocks or a map?+
nginx tests location blocks one at a time on every request, so a page of them is a linear scan. A map is a hash lookup — constant time regardless of size — which makes it the right answer past a few dozen rules. The map itself goes in the http block, not inside server, which is the usual reason a copied map fails to load.
Why "location =" rather than rewrite?+
The equals modifier is an exact match, and nginx stops searching the moment it hits one. It is both the precise semantics you want for a redirect list and the fastest form. rewrite with a regex is for patterns, not for a fixed mapping.
Does nginx keep the query string?+
Yes, automatically, as long as the target contains no question mark. Add a trailing ? to a target and the original query is discarded — the same one-character rule as Apache, which is the choice this tool makes explicit rather than leaving to be found out.
How do I apply the config safely?+
Run nginx -t first. A syntax error found during a reload takes the whole server down rather than the one rule, and -t catches it while the current config is still serving. Then nginx -s reload, which swaps workers without dropping connections.