vdesignu.

Tools menu

View all categories

Free tool

Nginx Rewrite Rules Generator

Generate Nginx rewrite rules for 301 (permanent) and 302 (redirect) URL redirects, ready to paste into your server block.

#nginxredirect #nginxrewrite #nginxconfig #serverblock

Nginx Rewrite Rules

Crawl Budget Preservation

Old Path
New URL

Your generated code will appear here

Deployment Note

  • Apache: Paste into the `.htaccess` file in your site root, above any CMS rules (such as the WordPress block). Requires `mod_rewrite`. Each rule matches the path with or without a trailing slash; query strings are passed through.

  • Nginx: Place inside your `server ` block and reload Nginx for changes to take effect.

How to use this tool

Follow these steps to get the most out of the Nginx Rewrite Rules Generator.

01

Enter your accurate data in the provided form fields.

02

Review all configuration options and settings.

03

Click the generate or proceed button to execute.

04

Copy, download, or implement the professional output.

In depth

Rewrite Rules in Nginx

The generator writes one rewrite line per redirect: the old path as an anchored regular expression (matching with or without a trailing slash), then the permanent flag for a 301 or redirect for a 302. Paste the lines inside the server { } block for the site.

Reload Safely

Run nginx -t to test the configuration before reloading Nginx. For a single fixed URL, a location = /old-page { return 301 /new-page; } block does the same job without a regular expression.

Want it done for you?

Moving to a new site or platform? We rebuild sites and migrate them without losing the rankings you've earned.

Website Design & Development

More in Redirects & Migrations

Related tools