.htaccess redirect generator

Use this .htaccess redirect generator to turn a list of old and new URLs into 301 rules for Apache, Nginx, Netlify, Vercel, Cloudflare or IIS. Chains and loops are flagged first.

Free, no account. The rules are written in your browser and the list is not sent.

Separate the two addresses with a tab, comma, semicolon or space. A copy from a spreadsheet works. Up to 5,000 rows.

Optional. Old URLs on this host are read as paths, and the Cloudflare file and the redirect checker use it.

Server or host

Your .htaccess file

Paste your list, or try the example, to see the rules here.

A 301 redirect sends visitors and search engines from an old address to its new one and tells them the move is permanent. Paste two columns of old and new URLs. The generator writes the rules for your server, follows chains to their final address, drops loops and duplicates, and says which rules a host cannot express.

How this works

Paste the list
One redirect per line: the old address, then the new one, separated by a tab, comma, semicolon or spaces. A two column CSV or a copy from a spreadsheet works, and a header row is skipped. Old addresses can be paths or full URLs, up to 5,000 rows.
Checks before writing
The same old address twice is merged when both rows point to the same place; when they differ, the first row is kept. A redirect to itself is dropped. A chain such as A to B to C becomes A straight to C, and loops are left out because they never finish.
Query strings
A rule for a bare path matches that path with any query string. A rule with a query string matches only that query and is placed first. The Netlify and Cloudflare files written here match paths only, so those rows are left out of them and listed.
Six formats
Apache .htaccess with mod_rewrite, an Nginx server block, a Netlify _redirects file, a vercel.json with status 301, the CSV that Cloudflare Bulk Redirects imports and an IIS web.config with URL Rewrite rules.

Questions about redirects

Both mean the move is permanent, and Google treats them the same way. A 308 also keeps the request method, which matters for forms and APIs. Vercel sends 308 for permanent: true, so the vercel.json file sets statusCode 301 instead.

In the .htaccess file at the root of the site, above the rules your CMS adds, so they run first. The patterns are written for .htaccess, where the leading slash is removed before matching; inside a virtual host they would need it back.

The generator writes path rules for both, so a rule for one query string is left out of those files. Netlify also reads * and :name in a path as patterns, so those paths are skipped too. The page lists every skipped row. In Cloudflare, add them as Single Redirects with a query condition.

No. Point each old page to its closest new match. Google may treat a redirect from a specific page to the home page as a soft 404, and visitors land somewhere they did not expect.

Open the redirect checker from the result. It follows each hop and shows the status codes, so a chain or a temporary redirect left behind is easy to spot.

Check your business in AI answers

Pages that crawlers can read and follow are the groundwork. The free AI visibility scan shows how assistants answer about your business and what to work on next.