.htaccess Redirect Generator
Generate Apache redirect and HTTPS rewrite rules
⚠ Enter the path you want to redirect from.⚠ Enter where the old path should point.⚠ The source and destination are the same.
.htaccess file in your site root. The file needs Apache with mod_rewrite enabled, and rewriting must be allowed by the server configuration. About the .htaccess Redirect Generator
The .htaccess Redirect Generator writes mod_rewrite rules for common site changes. Redirect a single old URL, force HTTPS, or consolidate www traffic onto the bare domain.
Redirect chains slow pages down and dilute signals, so point old URLs straight at the final destination. After deploying, test a few old links with redirects disabled in the browser cache.
- ✓Single-path redirect with status code
- ✓Force HTTPS rule
- ✓www to non-www consolidation
How to use the .htaccess Redirect Generator
- 1
Enter the old path and the new destination.
- 2
Choose 301 or 302 and enable HTTPS or www rules.
- 3
Copy the block into your .htaccess file.
Frequently asked questions
When should I use 302 instead of 301?+
Use 302 for temporary moves so browsers keep requesting the original URL. A 301 is cached for a long time, which is right for a permanent change but hard to undo.
Why do my rules cause a redirect loop?+
Usually the destination still matches the source pattern, or HTTPS and www rules point at each other. Check the target URL and keep only one canonical host rule.
Save .htaccess Redirect Generator to your favorites, or keep browsing developer tools.
Browse all 35 developer tools →