ProMapRanker
🛠 Scheduled maintenance: We're performing scheduled maintenance on our scanning engine. New scans, audits and lookups are temporarily paused and will resume in approximately 12 hours. Your existing reports and dashboards remain fully available.
Free tools · URL & Technical SEO

Nginx Redirect Generator

Generate clean Nginx redirect rules for single URLs, folders or full domain moves without hand-writing server config.

What is the nginx redirect generator?

The nginx redirect generator is a free tool that builds clean, ready-to-paste Nginx redirect rules for single URLs, folders, or a full domain move, so you never have to hand-write server config from memory. The correct pattern it favors is a dedicated server block that catches the old host or path and issues a permanent redirect with return 301 https://new/$request_uri;. That single directive is faster and safer than a rewrite in most cases. A 301 is permanent and passes ranking signal to the new URL, while a 302 is temporary and tells search engines the original location will return. It turns those choices into copy-paste output that reloads cleanly.

Nginx redirect generator for technical SEO

Hand-writing redirect rules is where small mistakes cause big problems. A misplaced slash, a greedy regular expression, or a status code left at the default 302 can quietly leak link equity or send visitors into a loop. Instead of memorizing directive syntax, you describe the move in plain terms (this old URL now lives at this new URL) and the generator produces the matching server block. It handles the common cases local businesses actually face: retiring a seasonal landing page, merging two near-duplicate service pages, or moving an entire site to a new domain after a rebrand. The output stays short and correct, which means fewer surprises when you run nginx -t and reload.

How do you use the nginx redirect generator?

Using the nginx redirect generator takes under a minute. You pick the redirect type, enter the source and destination, choose whether the rule covers one URL or a whole path, and copy the generated block. The tool writes the directive for you so the syntax is correct on the first try, ready to drop into your Nginx configuration and reload the service.

  1. Choose the redirect status you need. Select 301 for a permanent move (the default for SEO) or 302 when the change is genuinely temporary.
  2. Enter the old URL or path in the source field. This is the address visitors and search engines currently reach.
  3. Enter the new destination URL. If you are consolidating pages, point every retired address at the single page you want to keep.
  4. Pick the scope: a single exact URL, a folder or prefix, or a full domain move. The generator adjusts the location matching and whether it preserves the incoming path.
  5. Review the preview. Confirm the status code, the destination, and that $request_uri is present when you want to keep the original path segment.
  6. Copy the output, paste the rules into your server block, run nginx -t to test, then reload nginx so the redirect goes live.

The final output is a clean set of redirect rules you paste into your server block and activate with a reload. Because the tool tests the shape of the directive before you copy it, the step that usually breaks (a typo that fails the config test) is handled for you.

Why do nginx redirects matter for SEO?

Redirects are how you move traffic and ranking authority from an old address to a new one without losing the value you already earned. When you issue an nginx 301 redirect, you tell Google the move is permanent, and the large majority of the original page's link equity transfers to the destination. Skip the redirect, or use the wrong status, and inbound links point at a dead page, rankings drop, and visitors hit a 404. For a local business, that can mean a service page that ranked in the map pack suddenly disappears from view.

The bigger technical risk is redirect chains and loops. A chain happens when URL A redirects to B, which redirects to C, forcing browsers and crawlers through extra hops that waste crawl budget and slow page loads. A loop, where two rules point at each other, breaks the page entirely. Well-built redirect rules go straight from the old URL to the final destination in one step. This is also why HTTPS and www canonicalization belong in your server block: you want exactly one canonical version of every page, with http redirecting to https and either www or non-www chosen as the single home, so signals are not split across duplicates.

For local landing page moves, redirects preserve the equity behind city and service pages you have spent months building. If you rename a page from an old slug to a cleaner one, or merge two overlapping neighborhood pages, a clean 301 keeps the rankings, reviews context, and backlinks pointing where they should. Getting these moves right protects the local visibility you can measure with tools like the ProMapRanker geo-grid rank checker, and it keeps the customer journey from search result to booking form intact.

Understanding nginx redirect rules (anatomy)

Every Nginx redirect is built from a few predictable parts: a server or location block that decides which requests match, a status code that signals permanence, and a destination that may or may not preserve the original path. Once you can read those parts, the generated output stops looking like cryptic config and starts reading like a plain instruction. The diagram below shows the flow and the core difference between the two status codes.

Nginx redirect generator flow: old URL through a 301 redirect to the new URL, with a 301 vs 302 comparison for nginx 301 redirect rules How an Nginx 301 redirect moves a URL Old URL /old-page return 301 permanent passes ranking signal New URL /new-page 301 vs 302 at a glance 301 Permanent Move is final Passes link equity Use for migrations 302 Temporary Original returns later Signal stays on old URL Use for short tests

return 301 vs rewrite

Nginx gives you two ways to redirect, and the choice matters for speed and predictability. The return 301 directive is a direct, one-line instruction: match a request, send a status code, hand back a new location. An nginx rewrite uses regular expressions to transform the request and is more powerful, but also easier to get wrong and slightly heavier to process. For most single URL and simple folder moves, return 301 is the cleaner choice. Reserve rewrite for cases where you genuinely need pattern capture, such as mapping many old paths to new ones with shared structure. When a rewrite is used only to redirect rather than to internally remap, the permanent flag turns it into a proper 301 response.

301 vs 302

The status code is the single most consequential choice in any redirect rule. A 301 says the resource has moved permanently, and search engines respond by transferring ranking signal to the destination and updating their index over time. A 302 says the move is temporary, so engines keep the original URL indexed and hold the authority there. Using a 302 for a permanent migration is one of the most common and most damaging mistakes, because the new page never inherits the strength of the old one. If in doubt and the change is meant to stick, choose 301.

Single URL vs folder vs full domain

Scope determines how the location matching in your server block is written. A single URL redirect targets one exact path and sends it to one destination, ideal for retiring a specific page. A folder or prefix redirect catches every URL under a path (for example everything below /blog/) and can either flatten them to one page or preserve the tail. A full domain move redirects an entire hostname to a new one, which is the migration case where $request_uri is essential so that every deep link lands on its matching page rather than dumping all visitors on the homepage.

$request_uri and preserving paths

The $request_uri variable holds the full original path and query string of the incoming request. Appending it to your destination, as in return 301 https://newdomain.com$request_uri;, tells Nginx to carry the visitor's exact path across to the new domain. Without it, a request for /services/plumbing would be flung to the bare homepage, breaking deep links and wasting the equity those inner pages earned. Preserving paths this way is the difference between a migration that keeps rankings and one that resets them. Use it for domain moves and any folder redirect where the inner structure should survive.

Best practices and common mistakes

A few disciplined habits separate redirects that protect your SEO from ones that quietly erode it. Most failures come from skipping the test step or from letting rules stack up over time. Keep the list below close whenever you edit your server block.

  • Never build redirect chains. Point the old URL directly at the final destination, not at an intermediate page that redirects again, so crawlers and browsers resolve in one hop.
  • Always run nginx -t before you reload. This tests the configuration for syntax errors and prevents a broken block from taking your whole site offline.
  • Know the difference between exact and prefix matching. An exact match hits one URL, while a prefix or regex match can catch far more than you intended, so scope each rule deliberately.
  • Set the status code on purpose. Leave a permanent move on 301, and only reach for 302 when the original page will truly come back.
  • Test the redirect after reloading. Request the old URL and confirm it lands on the right destination with the expected status before you consider the change done.
  • Audit for loops. Make sure no two rules redirect to each other, since a loop returns an error and blocks access to the affected pages entirely.

When should you use the nginx redirect generator?

The nginx redirect generator earns its place any time a URL changes and you need search engines and visitors to follow. It is most valuable in four recurring situations, each of which carries real SEO risk if the redirect rules are wrong or missing. Reach for it whenever a page or domain is about to move.

  • Site migration. When you move to a new domain after a rebrand or acquisition, a full domain 301 with $request_uri carries every deep link and its ranking signal to the matching new page.
  • HTTP to HTTPS. Force every insecure request to the secure version so you serve one canonical protocol, protect visitor trust, and avoid splitting signals between two versions of each page.
  • Consolidating duplicate local pages. When two city or service pages compete for the same terms, redirect the weaker one into the stronger so their combined authority lifts a single page in local results.
  • Retiring old URLs. When a seasonal promotion, old blog post, or discontinued service page comes down, a 301 to the nearest relevant page preserves any links it earned instead of returning a dead 404.

Frequently asked questions

Does the generator write valid server block syntax?

Yes. The nginx redirect generator produces directives structured for a standard server block, using return 301 for permanent moves and correct location matching for your chosen scope. You still run nginx -t before reloading, which confirms the config is valid in your specific environment before it goes live.

Should I use return 301 or an nginx rewrite?

For single URLs and simple folder moves, return 301 is cleaner, faster, and less error prone. Choose an nginx rewrite only when you need regular expression pattern capture to map many structured old paths onto new ones. When a rewrite is used purely to redirect, add the permanent flag so it returns a true 301.

What is the difference between a 301 and a 302 redirect?

A 301 is permanent and passes ranking signal to the new URL, which is what you want for migrations and retired pages. A 302 is temporary and keeps the original URL indexed, so authority stays on the old address. Using 302 for a permanent move is a costly, common mistake.

How do I keep the original path during a domain move?

Append the $request_uri variable to your destination, for example return 301 https://newdomain.com$request_uri;. This carries the visitor's exact path and query string to the new domain so a request for an inner page lands on its counterpart rather than the homepage, preserving deep links and their equity.

Do I need to reload Nginx after adding redirect rules?

Yes. Paste the generated redirect rules into your server block, run nginx -t to test the configuration, then reload the service. A reload applies the new rules without dropping active connections. The change is not live until the reload completes successfully.

Will these redirects hurt my local rankings?

Correctly built 301 redirects protect local rankings by passing link equity to the new page and avoiding dead ends. Problems come from chains, loops, or wrong status codes, not from redirects themselves. Point old URLs straight to their final destination and your city and service pages keep their earned authority.

Ready to protect your local rankings?

Clean redirects keep your equity intact, and tracking keeps you honest about the results. See exactly where your business ranks across a real geo-grid, spot the pages worth consolidating, and measure the impact of every technical fix you ship. start free with 150 credits and put your local visibility on a map today.

Related tools

For deeper reference, see Google's guidance on 301 redirects and the official Nginx rewrite module documentation.

Related tools

Track your real Google Maps rankings

These free tools get you set up - ProMapRanker shows where you actually rank across your whole service area on a geo-grid.

Start free - 150 credits