Back to home

Redirect Rules Generator

Write one redirect per line as old path then new path. Choose the server type and the redirect code, then copy or download the ready-to-use rules.

  1. Write one old and new URL per line
  2. Choose Apache, Nginx or _redirects
  3. Copy or download the rules
Loading the tool...

Your files never leave your device

How the redirect generator works

When a page moves, every old link, bookmark and search result still points at the old address. A redirect rule tells the server to send visitors and search engines to the new address instead. Write one pair per line, old address first and new address second, pick Apache, Nginx or a _redirects file, and the tool writes the rules for that server.

A worked example

Imagine a shop that renamed three category pages, so the list has three lines such as /shoes-old followed by /footwear. You choose 301, because the move is permanent, and select Apache. The result contains three rules ready to paste into the .htaccess file, and the tool shows how many lines it could not read so you can fix them.

Two optional switches add site-wide rules. One sends all HTTP traffic to HTTPS and the other sends www to the non-www host, and they apply to the Apache and Nginx output only. For Apache they work on whatever host the request arrives at, while the Nginx server block is built from the domain you type in the domain field, so fill that in when using Nginx. Lines that start with # are ignored, which lets you keep comments in your list.

Limits and common mistakes

Redirect chains and loops are the most common problems. If /a goes to /b and /b goes to /c, update the first rule to go to /c directly, otherwise every visit makes extra requests and search engines may stop following. A rule that redirects a page to itself creates a loop that browsers refuse to load.

The generator only writes text. Where it goes depends on your host: .htaccess for Apache, the server block for Nginx, or the site root for Cloudflare Pages and Netlify. Always test a few old URLs after publishing.

Frequently asked questions

Which redirect code should I use?

Use 301 for permanent moves, so search engines transfer the old page's ranking signals to the new address. Use 302 or 307 only when the move is temporary, for example during maintenance.

Can I redirect to another domain?

Yes. Write the full URL, including https://, as the new address. The old side can stay a simple path on your own site.

Where do I put the rules?

Apache rules go in the .htaccess file, Nginx rules in the server block of your site configuration, and the _redirects text goes in the site root for Cloudflare Pages or Netlify. Reload the server after changing Nginx.

How are query strings handled?

An old URL that contains a question mark is matched against that exact query string. If you want every query variant to move, write the path without the query part.

Can I add comments?

Yes. Any line starting with # is ignored by the generator, so you can keep notes about why a page was moved.

Is anything uploaded?

No. The rules are built on your device and your list of URLs is never sent to a server.

Related tools

Save this tool to use it later

Add this page to your browser bookmarks by pressing Ctrl + D