.htaccess redirect generator: create safe 301 & 302 rules
Generate copy-ready redirect rules for Apache, Nginx, or Cloudflare - single URLs, bulk lists, force-HTTPS, www, and trailing slashes - with built-in loop checks. Free, runs in your browser.
- No signup required
- Apache, Nginx & Cloudflare
- Loop & chain checks
What do you want to redirect?
.htaccess rule
# Enter both the old path and the new URL.Place this in the .htaccess file at your site root, above any existing rules. Test before and after with our redirect checker.
Planning a site migration?
We map and test every redirect so you keep your rankings and your visitors never hit a dead link.
Talk to an engineer about thisA redirect sends visitors and search engines from an old URL to a new one. Get the rule right and you keep your rankings; get it wrong and you create loops, lose link equity, or break your site.
This generator writes correct, copy-ready redirect rules for Apache, Nginx, and Cloudflare - so you never have to hand-write mod_rewrite syntax again.
What this tool generates
Single & bulk redirects
One old → new pair, or paste a whole migration map at once.
Force HTTPS
Redirect every HTTP request to its secure HTTPS version.
www canonicalization
Force www → non-www (or the reverse) to avoid duplicate content.
Trailing slashes
Add or remove trailing slashes consistently across the site.
How to create and install a redirect
- Pick a scenario - single, bulk, force-HTTPS, www, or trailing slash.
- Enter your URLs and choose your server (Apache, Nginx, or Cloudflare) and redirect type.
- Copy the rule the tool generates.
- Install and test - add it to
.htaccessor your server block, then confirm it resolves in a single hop.
Which redirect status code should you use?
| Code | Meaning | Passes SEO? | Use it for |
|---|---|---|---|
| 301 | Permanent | Yes | Migrations, renamed/moved pages (~95% of cases) |
| 302 | Temporary | No (keeps old URL) | Maintenance, A/B tests, short-term moves |
| 307 | Temporary, method-preserving | No | APIs/forms where POST must stay POST |
| 308 | Permanent, method-preserving | Yes | Permanent API/form moves |
For the official reference, see MDN's guide to HTTP redirections.
Avoiding loops and chains
A redirect loop happens when a URL redirects to itself or back through a cycle - the browser gives up with a "too many redirects" error.
A redirect chain is A→B→C: every extra hop slows the page, wastes crawl budget, and dilutes link equity.
The rules: never point a URL at itself, always redirect straight to the final destination, and delete old rules when you restructure. This generator flags identical source/destination pairs and duplicate sources before you ship them.
Redirects and SEO during a migration
When you change URLs, a clean 301 from every old URL to its closest new equivalent is what carries your rankings across.
Skipping redirects creates 404s that drop out of the index; redirecting everything to the homepage is treated as a soft 404 and loses the page's value.
Map each old URL to a relevant new one, redirect in a single hop, then re-test. After deploying, verify your rules with the redirect & HTTP status checker.
Related technical-SEO tools
- Redirect & HTTP status checker - trace your redirect chains and confirm a single-hop 301.
- DNS lookup - verify your records before and after a move.
- Broken link checker - find the dead links your redirects should fix.
- Website launch checklist - everything to verify before going live.
Try these next
Browse all SEO tools- DNS Lookup & CheckerCheck any domain's DNS records instantly
- Domain Age & WHOIS CheckerHow old is any domain?
- Website Down CheckerIs it down for everyone, or just you?
- Redirect & HTTP Status CheckerTrace 301/302 redirect chains
- Cron Expression GeneratorBuild, decode & preview cron schedules
- Schema Markup GeneratorCreate valid JSON-LD structured data
Guides on this topic
Your questions, answered
Have a question about your project? Ask us on a free call, and we'll give you a straight answer.
What is an .htaccess redirect generator?
What is the difference between a 301 and 302 redirect?
When should I use a 307 or 308 redirect?
Where do I put the .htaccess redirect code?
How do I redirect HTTP to HTTPS?
How do I avoid redirect loops and chains?
Do redirects affect SEO?
Is this redirect generator free?
301 vs 302?
When do I use 307 or 308?
Where does the code go?
Is it free?
Tell us about your project
Tell us what you're building, when you need it, and what's in the way. A senior engineer will reply within one business day with honest next steps, even if that means we're not the right fit.
- Your project is led by a senior engineer, not a junior and not AI on its own
- AI speeds up the build. Every change is reviewed and tested before it ships
- Best for MVPs, SaaS products, automation, and fixing apps that keep breaking
