Something wrong with this tool?
About Htaccess Redirect Generator Online
This tool builds .htaccess redirect rules for Apache servers. Specify source patterns (paths, query strings, regexes) and destination URLs, and the tool outputs the matching RewriteRule, Redirect, or RedirectMatch directives ready to paste into your .htaccess.
Redirects are essential during site migrations, when restructuring URLs, after rebranding, or for SEO consolidation (canonical URLs, www/non-www, http/https). Without proper redirects, old links break and search rankings collapse.
The tool produces 301 (permanent) redirects by default — best for SEO — but supports 302 (temporary), 307, and 410 (Gone) for special cases. Test each rule before deploying; a misconfigured .htaccess can take a whole site down.
How to use this tool
How to write an Apache .htaccess redirect rule
Source and destination
"Source path" is the URL path Apache should match (e.g. `/old-page` or `/blog/(.*)`). "Destination URL" is where the visitor goes (absolute URL recommended: `https://example.com/new-page`).
Status code
"Status code" picks `301` (Moved Permanently — for permanent URL changes, search engines update their index) or `302` (Found — temporary; the old URL stays canonical). For SEO-friendly migrations always use 301.
Press Run
Result returns a single `htaccess` field — a `Redirect <code> <source> <destination>` line ready to paste into `.htaccess` at your site root. Add `RewriteEngine On` above your block if it's not already there for other rules.
Test before going live
Use `curl -I https://example.com/old-page` to confirm the redirect returns the expected `Location:` header. A common pitfall is matching with a trailing slash on one side but not the other — Apache treats `/foo` and `/foo/` differently.