Home / Tools / Redirect Rules Generator

Redirect Rules Generator

Add one or more old-path/new-path pairs to generate redirect rules for your Apache .htaccess file or Nginx configuration.

rrg.log
waiting for input

Why redirects need to be generated carefully, not written by hand

A 301 or 302 redirect tells a browser, and any crawler following the same link, that a page has permanently or temporarily moved to a new address. Getting the syntax right matters more than it might seem: a small formatting mistake in an .htaccess or Nginx configuration file doesn't usually cause a single broken redirect — it can silently break an entire block of rules below it, or in more serious misconfigurations, take down access to the whole site until the file is fixed. This tool generates the exact syntax each server format expects from a simple set of old-path and new-path pairs, removing the most common source of hand-typed syntax mistakes.

It's worth being clear about what this tool does and doesn't do: it generates the redirect rule text for you to add to your own server configuration, but it can't apply, test, or verify that a live redirect actually works, since that would require your browser to make a request to your own live server infrastructure, which is outside what a static page like this one can do. After adding these rules to your actual server, it's worth manually visiting the old URLs to confirm each one redirects correctly, or using your hosting provider's own tools for testing configuration changes.

Choosing between a 301 and a 302

A 301 redirect signals a permanent move, and search engines generally consolidate the old URL's ranking signals onto the new destination over time — the correct choice any time a page has moved for good, such as after a URL restructuring, a domain migration, or retiring an old page in favor of a newer, more complete replacement. A 302 redirect signals a temporary move, appropriate for situations like a page under short-term maintenance or a temporary promotional redirect that will be reverted later; search engines are more cautious about transferring ranking signals through a 302, since the implication is that the old URL will return to active use.

Using a 302 for what's actually a permanent change is a common mistake that can slow down how quickly a new URL fully inherits the old one's search visibility, since search engines are, by design, more conservative about a redirect that's labeled as temporary. When in doubt about whether a move is permanent, a 301 is almost always the safer and more accurate choice for standard page moves and site restructuring.

Apache versus Nginx syntax

Apache's .htaccess format uses a simple "Redirect" directive followed by the status code, the old path, and the new destination, and can be added directly to an .htaccess file in the relevant directory on many standard hosting setups. Nginx doesn't use .htaccess files at all — its redirects are configured in the main server block configuration using a "rewrite" directive with a regular expression pattern and a "permanent" or "redirect" flag corresponding to a 301 or 302. This generator produces the correct syntax for whichever format you select, but placement still depends on your specific hosting environment — a shared host may only allow .htaccess edits, while a self-managed Nginx server requires editing the main configuration and reloading the service for changes to take effect.

Frequently asked questions

Does this tool actually set up the redirect on my server?

No. It generates the correct rule text for you to add to your own server configuration file. You'll still need to add the generated rules to your .htaccess file or Nginx configuration yourself and reload or redeploy as your hosting setup requires.

Should I use 301 or 302 for a permanent page move?

Use 301. It signals a permanent move and search engines generally transfer the old page's ranking signals to the new URL over time, which is the outcome you want for a permanent restructuring.

Can this tool verify my redirects are working after I add them?

No — checking whether a live redirect actually returns the correct status code requires a network request to your own server, which a static browser-based tool can't perform reliably for arbitrary sites. Test manually by visiting the old URL after deploying the change.

Why doesn't my shared host support the Nginx format?

Most shared hosting uses the Apache web server with .htaccess files for configuration, while Nginx requires direct access to the server's main configuration, which is typically only available on a VPS or dedicated server you manage yourself.