Updated · Built and checked by the PlinzoTools team, formulas tested against published sources
Generate 301/302/410 redirect rules for Apache .htaccess or Nginx, with wildcards and HTTPS, www and trailing-slash presets.
# Place above any existing rules (e.g. above # BEGIN WordPress)
RewriteEngine On
# Redirect rules
RewriteRule ^old-page/?$ /new-page [R=301,L]
RewriteRule ^blog/(.*)$ /articles/$1 [R=301,L]
RewriteRule ^summer-sale/?$ /offers [R=302,L]
RewriteRule ^discontinued-product/?$ - [G]This tool turns a plain list of old and new URLs into working redirect rules for either Apache (as .htaccess mod_rewrite rules) or Nginx (as a snippet for a server block). It handles exact paths, wildcard patterns that carry the rest of the URL across, 301/302/307/308 redirects and 410 Gone responses. One switch each adds the site-wide redirects most sites need: forcing HTTPS, adding or removing www, and adding or removing the trailing slash. Every rule is checked for loops, chains and typos before it is written.
Choose Apache or Nginx, then enter one rule per line as /old-path -> /new-path [301]. The status code is optional and defaults to 301. Use * to match anything: /blog/* -> /articles/* sends every old blog post to the same path under /articles/. For a page that is gone for good, write /old-page [410]. Tick or choose any site-wide redirects you need. Problems are listed by line number above the output, and lines with errors are left out of the file so a typo can't break your server.
301 is a permanent move; search engines transfer the old URL's signals to the new one. 302 is temporary, for a short-lived promotion or maintenance page. 307 and 308 are the temporary and permanent equivalents that guarantee a form POST stays a POST -- useful for APIs and forms, unnecessary for ordinary pages. 410 says the page was removed on purpose, which search engines usually act on a little faster than a 404.
After a restructure, update your sitemap with the Sitemap XML Generator so it lists only the new URLs, and check your crawl rules with the Robots.txt Generator.
A plain path matches exactly that page, with or without a trailing slash. /old-page catches /old-page and /old-page/, but not /old-page/photos. A * matches any characters, including slashes, and each * in the target is replaced by whatever the matching * in the source captured. Matching is case-sensitive, as on the server itself. Query strings can't be matched by a path rule, but they are carried across: a visitor to /old-page?ref=mail lands on /new-page?ref=mail. If your target contains its own ?, the original query string is dropped instead. Apache works this way by default, and the Nginx output copies it.
Encoded characters are handled for you. Both servers match the decoded path, so a source written as /caf%C3%A9 becomes a rule for /café. A percent sign in a target is escaped so Apache doesn't read %20 as one of its back-references, and the NE flag stops it encoding the target a second time.
The tool opens with four rules: an exact 301 from /old-page to /new-page, a wildcard 301 from /blog/* to /articles/*, a temporary 302 from /summer-sale to /offers, and /discontinued-product marked 410. With Force HTTPS ticked and "Force example.com (no www)" chosen, the Apache output has four parts:
RewriteEngine OnRewriteRule ^blog/(.*)$ /articles/$1 [R=301,L], and the 410 becomes RewriteRule ^discontinued-product/?$ - [G].Switch to Nginx and the same rules appear as location ~ "^/blog/(.*)$" { return 301 /articles/$1$is_args$args; } and similar blocks, with the www and HTTPS redirects as if ($host ...) and if ($scheme = http) lines.
/, sources with a query string, and targets that aren't a path or a full http(s) URL.* than its source.nginx -t before reloading.Yes. Choose Nginx and the same rules are written as Nginx location blocks and server-level directives, ready to paste inside your site's server { } block. Reload Nginx afterwards.
Into the file named .htaccess in your site's root folder, above any existing rules such as the # BEGIN WordPress block. The server must allow .htaccess overrides and have mod_rewrite enabled, which almost every shared host does.
Yes. Put * in the old path to match anything there, and * in the new path to reuse what it matched. /shop/* -> /store/* sends /shop/shoes/red to /store/shoes/red.
One engine keeps the behavior predictable. Mixing Redirect lines with RewriteRule blocks, such as WordPress's, is a common cause of rules being skipped or applied twice. Wildcards and the site-wide redirects also need mod_rewrite.
Lines with an error are left out on purpose. Look at the list above the output: each problem names its line number and what to fix.
Yes. Use a full URL as the target, such as https://newsite.com/page. Wildcards work too: /* -> https://newsite.com/* moves every path to the new domain.
On Apache, confirm .htaccess overrides and mod_rewrite are enabled and the file is in the site root. On Nginx, confirm the snippet is inside the right server block and that Nginx was reloaded. In both cases, rule out a cached redirect by testing in a private window.
Reference: MDN Web Docs