.htaccess Redirect Generator
An .htaccess redirect generator turns a plain list of old and new URLs into the exact Apache directives a server needs to send visitors and search engines to the right page. Redirects are the single most error-prone part of any migration: a missing anchor, an unescaped dot, or a 302 used where a 301 belongs can leak link equity, trigger redirect loops, or quietly break a launch. Getting the syntax right by hand, line by line, is slow and easy to fumble.
This tool builds paste-ready Redirect, RedirectMatch, and RewriteRule rules for single redirects, bulk old,new maps, and the common canonical patterns every site needs. It is free and runs entirely in the browser, so even an unpublished redirect map for a confidential migration never leaves the page.
/old-page.html
🔒 Private: everything runs in your browser. Nothing you paste is uploaded.
How to use the .htaccess redirect generator
Pick a tab, fill in the fields, and copy the generated block straight into your .htaccess file. Every rule is built live in the browser as you type.
Generate a single redirect and choose the right status code
On the Single tab, enter the old path on this site and the destination URL or path, then pick a status code. Use 301 for permanent moves so PageRank and link equity pass to the new URL, 302 or 307 for genuinely temporary changes, and 410 when a page is gone for good with no replacement. The tool emits a simple Redirect line for clean paths and automatically switches to an anchored RewriteRule with a RewriteCond when the old URL contains a query string, because Redirect alone cannot match one.
Convert a whole migration map in the Bulk tab
During a site migration you usually have a spreadsheet of old and new URLs. Paste it into the Bulk tab as one old,new pair per line and the generator outputs the complete block in one pass, skipping blank lines and flagging any row that is missing a comma or a value. Choose 301 or 302 for the whole set. The counter shows how many valid rules were produced versus skipped, so a malformed export is caught before it ever reaches the server and breaks the deploy.
Add canonical rules for HTTPS, www, slashes, and case
The Common patterns tab generates the recipes every site relies on: force HTTPS, redirect www to non-www or the reverse, add or remove a trailing slash, and force lowercase paths. Enter your domain once and tick the rules you need. The tool writes them in the correct order, escapes the domain in each RewriteCond, and warns when two choices conflict, such as adding and removing the trailing slash at the same time. Place this block near the top of .htaccess so canonicalization runs before page-level rules.
.htaccess redirect generator frequently asked questions
Q1Should I use a 301 or a 302 redirect for SEO?
Use a 301 for any permanent move, such as a migrated page, a changed URL structure, or a consolidated duplicate. A 301 signals search engines to transfer ranking signals and link equity to the new URL and to index it in place of the old one. Reserve 302 and 307 for genuinely temporary situations, like an A/B test or a seasonal landing page, where the original URL will return.
Q2Where do I put these rules in my .htaccess file?
Place canonical rules, such as force-HTTPS and www handling, near the top so they run before everything else, and put individual page redirects below them. On WordPress, add custom rules above the # BEGIN WordPress block, because anything inside that block can be overwritten. After saving, test a few URLs to confirm each one returns the expected status code and lands on the right page.
Q3Why does the tool sometimes output RewriteRule instead of Redirect?
The Apache Redirect directive matches only the path portion of a URL and cannot inspect a query string. When your old URL contains a question mark, the generator switches to mod_rewrite, adding a RewriteCond that matches the query string and a RewriteRule anchored with ^ and $, so only the intended URL is redirected. For plain paths it uses the simpler Redirect line because it is easier to read and maintain.
Q4Will these redirects cause an infinite loop?
A loop happens when a redirect points a URL back at itself or at another rule that returns to the start, often from mixing a www rule with its reverse or adding and removing a slash together. The generator anchors patterns, warns when a source and target look identical, and flags conflicting canonical choices. Still test after deploying, and clear your browser cache first, because browsers cache 301s aggressively and can mask a fix.
Q5Is my redirect data sent to a server?
No. Every rule is generated locally with client-side JavaScript, and nothing you type or paste, including a full migration map, is uploaded, logged, or stored. The tool keeps working after the page has loaded even with no connection, which makes it safe to use for unpublished sites, internal redirect plans, and confidential migrations that should never touch a third-party server.
