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.
| Code | Meaning | Use for |
|---|---|---|
| 301 | Permanent | Pages that moved for good |
| 302 | Temporary | A/B tests, short campaigns |
| 307 | Temporary, method kept | APIs and POST endpoints |
| 410 | Gone | Content 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
URL Parser
Break any URL into protocol, host, path, query parameters and hash, using the browser parser.
Open toolhtaccess to Nginx
Translate Apache RewriteRule lines into Nginx rewrite directives. Handles common 301 and 302 patterns; anything unusual is commented out.
Open toolHTTP Status Codes
Look up any HTTP status code by number or by name. A searchable list of the codes you actually meet in logs, APIs and browser dev tools.
Open toolMIME Type Lookup
Find the MIME type for a file extension, or the extensions for a MIME type, across images, fonts, documents and archives.
Open toolSVG to Data URI
Convert SVG markup into a URL-encoded data URI for CSS backgrounds. The output is quoted and escaped so it drops straight into a background-image rule.
Open toolIPv4 Subnet Calculator
Work out the network, broadcast, mask and usable hosts for a CIDR block. Essential for configuring firewalls, routers and VLANs correctly.
Open tool