Redirect rule generator
Write one redirect per line as old -> new and pick where your site runs. You get ready-to-paste rules for Apache .htaccess, nginx, Cloudflare Pages _redirects, Netlify, Vercel and Next.js, and a check that finds loops, chains and duplicates before they reach your visitors.
Use 301 or 308 when a page has moved for good (search engines pass its ranking to the new address). Use 302 or 307 only for short-term moves.
Checks
7 rules read, 7 kept after removing duplicates and self-redirects.
- Line 4: Chain with 2 steps: /a -> /b -> /c. Visitors and search engines make 2 requests; point the first address straight at /c.
- Line 6: /x is part of a redirect loop: visitors would bounce forever. This rule is left out of the output until you fix it.
- Line 7: /y is part of a redirect loop: visitors would bounce forever. This rule is left out of the output until you fix it.
Loop: /x -> /y -> /x
Put this in the .htaccess file of your site root (mod_alias must be on, which it is on most hosts). Each rule matches the exact path only.
How it works
- •Write each redirect as /old-path -> /new-path or -> https://other-site.com/page. Add 301, 302, 307 or 308 at the end of a line for a different status; the dropdown sets the default.
- •The checks list every problem by line: a path that redirects to itself, a rule repeated twice, a loop (A to B to A), and chains (A to B to C). Chains slow visitors down and waste crawl budget, so by default the output skips the middle steps and sends A straight to C.
- •Pick your platform. Each tab explains where the output goes and what it matches. Rules that sit in a loop are left out of the output until you fix them.
What it does and what it cannot do
- •Rules match one exact path. Wildcards, regular expressions, query-string matching and host-based rules are different on every platform, so write those by hand.
- •Chains and loops are found within your own list; redirects set up elsewhere on the server are invisible to this page.
- •Always test one rule on a staging site first, and watch for caching: browsers remember 301 and 308 for a long time.
- •Use 301 or 308 for permanent moves and 302 or 307 for short ones. 307 and 308 keep the request method (a POST stays a POST); 301 and 302 may turn it into GET.
Questions
- What is the difference between 301, 302, 307 and 308?
- 301 and 308 are permanent; 302 and 307 are temporary. 307 and 308 guarantee the browser repeats the same method (matters for forms and APIs), while 301 and 302 allow browsers to switch POST to GET. For normal pages, 301 is the usual choice.
- Does a 301 keep my search ranking?
- Search engines treat a 301 as a signal to move the page's ranking to the new address. Keep it in place for at least a year and update your own links and sitemap to the new URL.
- Why are chains bad?
- Each step is one more request, so pages load slower, and crawlers may stop following after several hops. Always point old addresses straight at the final page.
- Where does the .htaccess file go?
- In the root folder of the site (next to index.html or index.php), on Apache servers with mod_alias enabled. nginx has no .htaccess; use the nginx tab and reload the server.
- Is anything uploaded?
- No. The rules are built in this page; nothing is sent anywhere.