Htaccess Redirect Generator

Site-wide rules

Page redirects

One per line: the old path, a space or comma, then the new path or full URL.

Your .htaccess rules

Before you upload Keep a copy of the current .htaccess. A syntax error in this file takes the whole site down with a 500 error, and the only fix is to put the old one back — so having it saved matters more than anything else on this page.

Getting a redirect to actually fire

Apache reads .htaccess from the top and stops at the first matching rule that carries the L flag. That single fact explains most redirects that "do not work": a broad rule sitting above a specific one silently swallows it. The rules here are ordered specific-first for that reason.

Choosing the status code

  • 301 — moved for good. Passes ranking, and browsers cache it hard.
  • 302 — moved for now. The old URL stays indexed.
  • 410 — gone, with nothing replacing it. Clearer to search engines than a 404, and it drops out of the index faster.

Mistakes worth avoiding

  • Chains — A to B to C. Point A straight at C.
  • Loops — a page redirecting to itself, often from a trailing-slash rule fighting an HTTPS rule.
  • Everything to the home page — Google treats a mass redirect to the root as a soft 404. Send each page to its closest match, or let it 410.

Share this tool with friends

Free to use, no sign-up, works on any phone.

Frequently Asked Questions

When should I use 301 and when 302?

A 301 is permanent and passes ranking to the new URL, so use it for a page that has genuinely moved. A 302 is temporary and keeps the old URL indexed — right for a seasonal page or a page down for maintenance, wrong for a move.

Why is the order of the rules important?

Apache reads them top to bottom and the first match with an L flag wins. A broad rule placed first swallows everything below it, which is the single commonest reason a redirect "does not work". Specific rules go first here for exactly that reason.

Can I chain redirects?

You can, but do not. Each hop loses a little ranking signal and adds a round trip, and Google gives up after about five. If A moved to B and B later moved to C, change A to point straight at C.

How do I redirect a page with a query string?

RewriteRule cannot see the query string, so it needs a RewriteCond on %{QUERY_STRING} — the generator writes that for you when your source URL contains a question mark.

Does this work on Nginx or IIS?

No. This is Apache syntax, which also covers LiteSpeed and most shared cPanel hosting. Nginx uses a different configuration and does not read .htaccess at all.

How do I know if it worked?

Check the status code, not just the page. A correct move returns 301 on the first request and 200 on the destination. A browser caches a 301 aggressively, so test in a private window or with curl.

Everything on this page runs inside your own browser. Nothing you type or upload is sent to a server, so your data never leaves your device.