.htaccess Redirect Generator
Build Apache redirect rules without the syntax mistakes: one URL to another, a bulk list of moves, force HTTPS, force or strip www, and the WordPress block in the right order. Everything happens in your browser.
Your .htaccess rules
# Fill in the form above
Place your rules above the # BEGIN WordPress line. Test every redirect with the Redirect Checker after uploading; a wrong 301 is cached by browsers.
How to use it
- Pick the rule type: a single redirect, a bulk list (one old new pair per line), or the site-wide HTTPS and www rules.
- Enter the paths or domains. Paths start with a slash; targets can be a path or a full URL.
- Copy the generated rules into the .htaccess file in your site root, above the # BEGIN WordPress block, or download the file.
The three mistakes this generator avoids
Redirect rules fail in predictable ways. A Redirect line whose source is a prefix, so /blog also catches /blog-archive and /blog/anything. A target path that is relative, which Apache rejects. And the WordPress block: rules placed inside the # BEGIN WordPress markers are rewritten by WordPress when permalinks are saved, and rules placed after the block never run, because its final rule sends every request to index.php first.
The generator escapes regex characters in your paths, anchors the pattern to the exact URL, keeps query strings, and orders the output so your rules come first and the WordPress block last. Paste it, then confirm each redirect with the Redirect Checker.
.htaccess redirect FAQ
301 or 302: which redirect should I use?
A 301 is permanent: browsers cache it and search engines transfer the old URL's rankings to the new one. Use it when a page has moved for good. A 302 is temporary: nothing is cached or transferred, so use it for A/B tests, maintenance detours and campaign landing pages that will come back. When in doubt about a moved page, 301.
Where does the .htaccess file go on WordPress?
In the site root, the folder that holds wp-config.php. WordPress already keeps its permalink rules there between # BEGIN WordPress and # END WordPress markers and rewrites that block; put your own redirects ABOVE it, outside the markers, or WordPress may overwrite them when you save permalinks.
Redirect or RewriteRule: what is the difference?
Redirect (mod_alias) matches a path prefix literally and is the simplest form for one URL to another. RewriteRule (mod_rewrite) matches a regular expression and is needed for patterns, query strings, forcing https or www, and anything conditional. The generator uses Redirect for plain one-to-one moves and RewriteRule for the pattern rules; mixing both is fine as long as the Redirect lines sit before the rewrite block.
My redirects work but the query string is lost. Why?
Redirect keeps the query string by default; RewriteRule drops it unless the rule ends with [QSA] (append) or the target includes it. The generator adds the right flag. If you see a trailing ? on redirected URLs, add [QSD] to discard it.
Does this work on Nginx or on hosts without Apache?
No. .htaccess is Apache (and LiteSpeed, which reads it). Nginx uses rewrite or return directives in the server config, and many managed WordPress hosts ignore .htaccess entirely. On those, or when you would rather not edit server files, a redirect plugin handles the same job from the WordPress admin.
More free tools: Redirect Checker · HTTP Status Checker · WordPress robots.txt Generator · Slug Generator