htaccess Redirect Generator

Generate redirect rules for a site migration without hand-writing regex.

How htaccess Redirect Generator works

Turn a list of old and new URLs into Apache RewriteRule lines with 301 or 302 status. Everything happens inside this page: the tool reads your input, runs the calculation or conversion locally, and hands the result back to you. Nothing is transmitted, because there is no backend to transmit it to.

That design choice is deliberate. Most free tool sites upload your files to a server, process them there, and quietly keep a copy. Toolcin cannot do that — the site is a set of static files. If your connection dropped the moment the page finished loading, every tool would still work.

One redirect per line

Enter pairs as “from to”, one per line — either relative paths or full URLs. The tool emits the matching RewriteRule lines with the status code you choose.

301 is permanent and passes ranking signals; 302 is temporary and does not. Using 302 for a permanent move is the single most common redirect mistake, because browsers and search engines keep checking the old URL.

Order and matching

Apache applies rules in file order and stops at the first match, so a broad rule placed first shadows every specific rule after it. Put the specific paths before the catch-all.

Wildcards and regex capture groups are supported in the generated pattern, but a rule with a query string needs the query-string flag — otherwise the parameters are dropped silently on redirect.

CodeMeaningUse for
301PermanentPages that moved for good
302TemporaryA/B tests, short campaigns
307Temporary, method keptAPIs and POST endpoints
410GoneContent removed on purpose

Before you ship it

Test each rule with a request that has a query string attached. A redirect that loses ?utm_source breaks campaign attribution and looks like an analytics bug.

Keep a record of what redirected where. A chain of redirects — A to B, later B to C — costs latency and dilutes signals, and it is invisible unless someone writes it down.

Good to know

  • Works offline once loaded, including on flights and in locked-down networks.
  • No file size limit beyond your device's own memory.
  • Free to use, with no account and no usage counter.
  • Results are produced locally, so they are not logged or shared with anyone.

Questions

301 or 302?

301 for permanent moves that should pass ranking signals, 302 for temporary ones.

Will this work on Nginx?

No — Nginx needs its own rewrite syntax; the paths transfer, the directives do not.

Does this work on Nginx?

No. There is a separate htaccess to Nginx page that translates the common patterns.

Should the old URL include the domain?

Either form works; full URLs are clearer when several domains are involved.

Keep going

More web tools