.htaccess Redirect Generator
Generate Apache .htaccess 301 and 302 redirect rules from a list of old and new URLs, plus force-HTTPS and www rules.
How to use
- 1Enter one redirect per line: old path, a space, then the new URL.
- 2Choose the redirect type and extra rules, then paste the output into .htaccess.
Frequently asked questions
Should I use a 301 or 302 redirect?
Use 301 for permanent moves so search engines transfer rankings. Use 302 only for temporary changes.
Why does my redirect loop?
Usually a force-HTTPS or www rule conflicts with a host or proxy setting. Behind Cloudflare or a load balancer, check X-Forwarded-Proto instead of HTTPS.
Does .htaccess work on Nginx?
No. .htaccess is Apache-only (and LiteSpeed). Nginx uses return 301 rules in its server block.