Redirect generator for .htaccess, nginx and Cloudflare
Paste your old and new URLs, one pair per line, and get ready-to-use 301 or 302 redirect rules for Apache .htaccess, nginx, a Cloudflare _redirects file or a Cloudflare Worker. Folder redirects, HTTPS and www rules are included.
How to use the Redirect Rule Generator
- 1Paste your redirects, one per line: the old path, a space and the new path or URL.
- 2End both paths with * to move a whole folder, and add a status code to any line that needs a different one.
- 3Choose whether to keep query strings and whether to force HTTPS or change www.
- 4Pick your server, copy the rules and test a few old URLs after you deploy.
Frequently asked questions
Should I use a 301 or a 302 redirect?
Use 301 (or 308) when a page has moved for good: search engines move its ranking signals to the new address. Use 302 (or 307) for temporary moves, such as a seasonal sale page.
Where do I put .htaccess redirect rules?
In the .htaccess file in your site's root folder, near the top and before other rewrite blocks such as WordPress's. Your host must have mod_rewrite enabled, which almost all Apache hosts do.
How do I redirect a whole folder to a new folder?
End both paths with *, for example /blog/* /news/*. Every address under /blog/ then goes to the same path under /news/, so /blog/my-post becomes /news/my-post.
What is a redirect chain and why should I avoid it?
A chain is when one redirect leads to another before reaching the final page. Each hop slows visitors down and can waste search engine crawl budget, so point every old URL straight to its final address.
Related free tools
All toolsThen schedule it with Join Postly
Plan, publish and track your posts on every network from one calendar. Free plan, no credit card.