Omnikit
DevFilesMoneyAll tools
Ctrl K
Dev toolsFile toolsMoney calculatorsAll tools
HomeDeveloper tools.htaccess Redirect GeneratorNginx Redirect Generator

Nginx Redirect Generator

dev

Turn a list of old and new URLs into Nginx return 301 rules and server blocks

Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 16 Oct 2026.

Nginx redirects are written with return, not rewrite: one exact location = /old-page block per page, and a small server block to send HTTP to HTTPS and www to the bare domain, or the other way round. Paste your old and new addresses and enter the domain, and the blocks are written for you, with the query string carried over by $is_args$args unless you turn that off.

Next:
  • Nginx Config Generator A commented nginx server block for a reverse proxy, static site, SPA or redirect

How to redirect URLs in Nginx

1

Paste one redirect per line: the old path, a space, then the new path or URL.

2

Check that Nginx is selected and type your domain, such as example.com.

3

Copy the location blocks into your server block, and the canonical server blocks above it.

4

Run nginx -t to check the configuration, then reload Nginx.

How Nginx Redirect Generator works

Paste one redirect per line, the old address and then the new one, and the rules are written as you type. Old addresses can be paths or full URLs copied from a browser or an analytics export; tabs, commas and arrows also work, so a spreadsheet column pair pastes straight in. Add a code at the end of a line to override the default, or write 410 instead of a new address for a page that is gone.

Apache. Every rule uses mod_rewrite. The simpler Redirect directive matches prefixes, so Redirect /shop /store also catches /shopping, and mixing the two modules runs them in an order that surprises people. Patterns are anchored and escaped, so a dot in old.html matches only a dot. An old address with a query string, such as /products?id=42, gets its own RewriteCond and the query is dropped from the new address.

Nginx. Each page gets an exact location = block with return. HTTPS and the www choice get their own server blocks, which need your domain.

The rest of the article, and all 6 questions about .htaccess Redirect Generator, are on the .htaccess Redirect Generator page.

Frequently asked questions

How do I redirect one page to another in .htaccess?

Add RewriteEngine On once, then one line per page: RewriteRule ^old-page$ /new-page [L,R=301]. The pattern has no leading slash in .htaccess, the caret and dollar make it match only that exact page, and R=301 makes the move permanent. Place the rules near the top of the file, before any WordPress or framework block.

How do I redirect HTTP to HTTPS and www to non-www in one step?

Combine the conditions so the visitor makes a single hop: redirect when HTTPS is off or the host starts with www, and send them to https plus the host without www. This generator writes exactly that with three RewriteCond lines and one RewriteRule, or a pair of server blocks for Nginx, instead of two separate redirects in a row.

Why does my .htaccess redirect cause a redirect loop?

A loop happens when a rule sends a page to an address that the same or another rule redirects back. Common causes are redirecting /page to /page/ while another rule strips the slash, or forcing HTTPS behind Cloudflare Flexible SSL, where the server always sees HTTP. This tool refuses rules that loop and names the line.

How do I redirect a URL with a query string?

RewriteRule never sees the query string, so match it with a RewriteCond first: RewriteCond %{QUERY_STRING} ^id=42$, then the RewriteRule for the path. Add the QSD flag so ?id=42 is not copied onto the new address. Pasting /products?id=42 /products/blue-mug here writes both lines for Apache, or an if ($args) test for Nginx.

Sources

  • Apache HTTP Server 2.4, mod_rewrite: RewriteRule and RewriteCondPatterns without the leading slash in .htaccess, the R, L, G, NE and QSD flags
  • Apache HTTP Server 2.4, Redirecting and Remapping with mod_rewriteCanonical host and HTTPS rules
  • nginx, ngx_http_rewrite_module: return and ifreturn with a code and URL, $is_args$args
  • nginx, ngx_http_core_module: locationExact-match location = /path
  • RFC 9110, HTTP Semantics, 15.4 Redirection 3xx and 15.5.11 410 Gone (IETF)301 and 308 permanent, 302 and 307 temporary, 410 removed on purpose

Last verified 16 October 2026.

Rates and rules change; check the source before you rely on a figure.

Still stuck? Ask about .htaccess Redirect Generator and anybody who knows can answer. No account needed.

More ways to use .htaccess Redirect Generator

  • .htaccess Redirect GeneratorPaste old and new URLs and get 301 rules for .htaccess or Nginx, checked for loops
  • 301 Redirect GeneratorGenerate permanent 301 redirects in bulk, with chains shortened and loops caught

On the related tools: Cron Expression Generator – Generate a cron expression by choosing when the job should run · Sitemap Index Generator – Split a large site into numbered sitemaps with an index file · Google Analytics URL Builder – The five utm parameters GA4 reads, with the naming traps flagged.

Related tools

All developer tools
UUID GeneratorRandom v4 and time-ordered v7 UUIDs, up to 1,000 at once, plus a validatorHash GeneratorMD5, SHA-1, SHA-256, SHA-384 and SHA-512 of text or files, with checksum compareCron Expression BuilderBuild a cron schedule from menus, read it in plain English, see the next runsSlug GeneratorClean URL slugs from titles, including accented and Hindi text, one or hundreds at onceMeta Tag GeneratorWrite title, description, canonical, Open Graph and Twitter tags with a live previewRobots.txt GeneratorBuild a robots.txt with presets, then check what every line really doesSitemap GeneratorTurn a list of URLs into a valid sitemap.xml, with an index when it gets too bigUTM BuilderBuild campaign links with source, medium and campaign, then export the lot as CSV
Was this tool helpful?
Omnikit

Small jobs, done in your browser. Free, fast and private. Files are never uploaded.

Files

  • Compress Image
  • Image to PDF
  • Merge PDF
  • Compress PDF
  • PDF to Word
  • Word to PDF

Dev

  • JSON Formatter & Validator
  • Base64 Encode & Decode
  • JWT Decoder, Verifier & Encoder
  • Password Generator
  • UUID Generator
  • Unix Timestamp Converter

Money

  • SIP Calculator
  • EMI Calculator
  • GST Calculator
  • FD Calculator
  • PPF Calculator
  • Lumpsum Calculator
GuidesQuestionsAboutHow we checkLaw library (beta)PrivacyTermsDisclosureContactMore: Exam practice (UGC NET Paper 1)Runs in your browser. Nothing is uploaded. © 2026 Omnikit (theomnikit.com)