Skip to main content

301 redirect rule generator

Generate 301 rules for Apache, Nginx, Netlify, or Vercel from a URL mapping. Free local processing with no account required.

  • Clipboard

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Local analysis

Turn a source → destination mapping list into 301 redirect rules for Apache, Nginx, Netlify, or Vercel.

Was this tool useful?

On this page

How does this tool work?

This generator turns a list of “old URL → new URL” mappings into 301 redirect rules ready to copy for Apache (.htaccess), Nginx, Netlify (_redirects) or Vercel (vercel.json). It saves writing hundreds of lines by hand during a redesign or a URL structure change, and flags the lines it could not read.

Each line holds a source and a destination separated by =>, a tab, a comma or a space, so a spreadsheet export pastes straight in. Empty lines and lines starting with # are ignored.

The source must be a path starting with / and containing no space. The destination can be a path (/new-page) or an absolute http or https URL, to redirect to another domain.

A malformed line or a source that is already used is set aside and counted in Ignored lines: one URL cannot have two destinations.

The rules are written in the chosen format: Redirect 301 for Apache, location = … return 301 for Nginx, source destination 301 for Netlify and a redirects object with permanent: true for Vercel.

How to use this tool

  1. Paste the mappings

    One redirect per line in the Redirects: source → destination field.

  2. Choose the output format

    Apache, Nginx, Netlify or Vercel depending on your server or host.

  3. Generate

    The Generated rules and Ignored lines counters appear with the rules.

  4. Copy or download

    The downloaded file has the expected name: apache-redirects.conf, nginx-redirects.conf, _redirects or vercel.json.

Use cases

Site redesign

Turn the redirect plan prepared in a spreadsheet into a file ready to deploy.

URL structure change

Redirect articles from /blog/2023/title to /guides/title without losing their inbound links.

Hosting change

Reuse the same mappings when moving from an Apache .htaccess to Netlify or Vercel.

Examples

Apache

The third line has no destination, so it is ignored. The other two become Redirect 301 rules, one to a path and one to a full URL.

Input

Redirects: source → destination:
/ancienne-page /nouvelle-page
/blog/2023/guide https://example.com/guides/guide
ligne-invalide
Output format: Apache

Result

Generated rules: 2 · Ignored lines: 1
Redirect 301 /ancienne-page /nouvelle-page
Redirect 301 /blog/2023/guide https://example.com/guides/guide

Nginx

The same mappings produce location blocks to place inside the server block of the Nginx configuration.

Input

Redirects: source → destination:
/ancienne-page /nouvelle-page
/blog/2023/guide https://example.com/guides/guide
ligne-invalide
Output format: Nginx

Result

Generated rules: 2 · Ignored lines: 1
location = /ancienne-page { return 301 /nouvelle-page; }
location = /blog/2023/guide { return 301 https://example.com/guides/guide; }

Tips and best practices

  • Redirect each old URL to the closest page by topic, not automatically to the home page: Google treats such redirects as soft 404s.
  • Avoid chains: if A redirects to B and B to C, point A straight to C.
  • With Apache, Redirect rules belong in the root directory’s .htaccess (mod_alias enabled); with Nginx, reload the configuration after adding them.
  • Test a few URLs after deployment to check the 301 status and the destination.

Sources and references

Frequently asked questions

Which redirect status is generated?

A 301 (permanent) for Apache, Nginx and Netlify. For Vercel, the tool writes permanent: true, which Vercel serves as a 308, also permanent and treated as equivalent by Google.

Which separators are accepted between source and destination?

=>, a tab, a comma or one or more spaces, in that order of priority. Copying two columns from a spreadsheet works directly.

Why is a line ignored?

The source does not start with /, contains a space or is already used, or the destination is missing or is neither a path nor an http or https URL.

Can I redirect with regular expressions?

No. The tool generates exact redirects, one URL to one URL. For a pattern (a whole directory), write a RewriteRule or rewrite rule by hand.

Are my URLs sent to a server?

No. The rules are generated in your browser.

Related tools

Tools similar or complementary to this one.

Works well with

Validate, normalize and inspect web addresses locally.

Web & SEOUse this tool

Compare two sitemaps or URL lists and identify added and removed URLs.

Web & SEOUse this tool
TutorialBest practicesBeginner

Optimize images for the Web without losing quality

Resize, compress and choose between WebP, AVIF and other formats with a practical workflow that reduces file size without unnecessary visual loss.

30 August 20264 min