Home › SEO Tools › Htaccess Redirect Generator

Htaccess Redirect Generator

Turn a list of old and new URLs into tested redirect rules for Apache, Nginx, Netlify or Vercel.

Site-wide rules

Server

    Test a URL against your list

    How to use the htaccess redirect generator

    Paste your old and new URLs, one pair per line, and tick any site-wide rules. The redirect code builds as you type, with checks for loops and chains.

    1. Paste redirects as old URL and new URL. Two columns copied from a spreadsheet work.
    2. Choose the status code. 301 suits almost every permanent move.
    3. Tick site-wide rules such as https, www and trailing slashes.
    4. Pick your server: Apache .htaccess, Nginx, Netlify or Cloudflare Pages, or Vercel.
    5. Test a few old URLs in the tester, then copy or download the rules.

    Back up your current .htaccess file before you change it. One typo in that file can take a whole site offline.

    What is a 301 redirect?

    A 301 redirect tells browsers and search engines that a page has moved for good. Visitors land on the new address, and search engines move the old page’s signals to it over time.

    CodeMeaningUse it for
    301Moved permanentlyMost page and site moves
    308Permanent, keeps the request methodForms and APIs that post data
    302Found, temporaryShort campaigns and tests
    307Temporary, keeps the request methodTemporary moves for forms and APIs

    RewriteRule or Redirect?

    Apache offers two ways to redirect. The Redirect line from mod_alias is short and easy to read, but it cannot match query strings or patterns.

    RewriteRule from mod_rewrite is more flexible. It can match URLs with ?id=12 and handle https and www in the same file. The generator uses RewriteRule by default, and switches a line to RewriteRule when it needs a query string.

    Site-wide rules

    • Force https: sends every http request to the secure address. It also checks the X-Forwarded-Proto header, so it works behind most proxies.
    • www or non-www: pick one version of the domain and send the other to it.
    • Trailing slashes: add or remove them, so each page has one address.
    • index.html and index.php: send them to the clean folder address.
    • Moving domains: send every path to the same path on the new domain.

    Avoid chains and loops

    A chain happens when page A redirects to B, and B redirects to C. Each hop slows the visit, and search engines may stop following after several hops.

    The checks spot chains in your list and tell you where to point the first rule instead. They also catch loops, where a page sends visitors back to itself, and duplicate sources.

    Use the tester to follow any old URL through your list. It shows each hop and warns when there is more than one.

    Redirects during a site migration

    • Map every old URL that has traffic or links to its closest new page.
    • Avoid sending everything to the home page. Search engines may treat that as a soft 404.
    • Keep the redirects in place for at least a year.
    • Update internal links and your sitemap to the new addresses.

    Why this redirect generator is different

    Most htaccess redirect generator tools handle one rule at a time, or only Apache. This one does bulk lists for four servers and checks the result.

    • Bulk redirects from pasted columns.
    • Apache, Nginx, Netlify and Cloudflare Pages, and Vercel output.
    • https, www, trailing slash, index file and domain move rules.
    • Checks for loops, chains and duplicates, plus a URL tester.

    Use it as a 301 redirect generator, an htaccess URL redirect generator or a plain URL redirect generator. Some search for a generator htaccess tool, an htaccess 301 generator or an htaccess generator online.

    Every version is the same redirect generator underneath: an htaccess 301 redirect generator that also writes rules for other servers. When old pages need a new home, our URL Slug Generator helps you plan clean addresses.

    Private by design

    The htaccess redirect generator runs in your browser. Nothing you type or paste is sent to a server, and there is no sign-up.

    Your last settings are saved on this device only. The tool is ready when you come back.

    Frequently asked questions

    How do I create a 301 redirect in .htaccess?

    Paste the old and new URLs above and copy the rules. Add them near the top of the .htaccess file in your site root.

    Should I use 301 or 302?

    Use 301 for permanent moves. Use 302 only for short, temporary changes.

    What is the difference between Redirect and RewriteRule?

    Redirect is simpler but cannot match query strings or patterns. RewriteRule can, and handles https and www rules too.

    How do I force https with .htaccess?

    Tick Force https. The generator writes a rule that sends every http request to the https address.

    What is a redirect chain?

    A redirect that leads to another redirect. Point the first rule straight to the final page instead.

    Does this work on Nginx?

    Yes. Switch the server to Nginx for location blocks you can paste into the server block.

    Where is the .htaccess file?

    In the root folder of your site on Apache hosting. It starts with a dot, so turn on hidden files to see it.

    Is this redirect generator free?

    Yes. There is no sign-up and no limit. It runs in your browser.

    Last reviewed 2026-11-30 · How we build and check our tools