↑↓ to move ↵ to open Esc to close Browse all tools

Redirect Generator

Paste old and new URLs, pick 301, 302, 307 or 308, and get redirect rules for your server, with every path escaped and chains and loops flagged.

Embed

Redirect generator

Paste two columns from a spreadsheet, CSV, or "old new" separated by a space. Paths like /old-page or full URLs both work. An optional third column sets the status code for that line.
Redirect type
Query string of the old URL
For example ?utm_source=news on an old link.
Your redirect rules

 
Checks

    The rules are written in your browser. Nothing you enter is sent to a server.

    Hand-checked listFree SEO ToolsSEO tools that cost nothing, with the daily limits, account rules and crawl caps from the official pages.

    Redirect Generator by Freebiefy, free online tools · Privacy · Legal notice

    Embed this tool on your site

    Paste this code into your page. The tool runs in the visitor's browser, free and without signup. The height adjusts to the content. All tools you can embed

    What a redirect does

    A redirect answers a request for an old URL with a status code and the new address, and the browser or crawler goes there instead. You need one whenever a URL changes: after a redesign, when you merge two pages, move a blog to a new folder, switch to a new domain or delete a page that has a good replacement. Without it, visitors from old links and bookmarks land on a 404 page, and Google removes indexed URLs from its index once they answer with a 4xx error.

    Google's guide Redirects and Google Search recommends server-side redirects as the method Google is most likely to interpret correctly. This generator writes them for the most common servers and hosts from a simple list of old and new URLs, so you can move hundreds of pages without typing a single rule by hand. To check what a URL answers once the rules are live, use the HTTP header checker.

    301, 302, 307 and 308

    The four status codes are defined in RFC 9110, the HTTP standard. Two say the move is permanent, two say it is temporary, and they differ in what a browser may do with a form submission.

    CodeMeaningPOST may become GET
    301Moved permanentlyYes
    308Moved permanentlyNo
    302Found, temporaryYes
    307Temporary redirectNo

    For search, the line that matters is permanent versus temporary. Google says a permanent redirect is a strong signal that the new URL should be the one shown in search results, while a temporary redirect is only a weak signal, so the old URL may stay in the results. Per Google's documentation on HTTP status codes, 308 is equivalent to 301 and 307 to 302. Use 301 or 308 when a page has moved for good, and 302 or 307 for a short-term detour such as a sale page or maintenance.

    Rules for each server

    • Apache .htaccess, RewriteRule. This is the default, because it matches each old path exactly. mod_rewrite matches a regular expression against the decoded path. In an .htaccess file the leading slash is stripped first, so the pattern for /old-page is ^old-page$. Dots, question marks, plus signs, brackets and other special characters in your paths are escaped with a backslash, and a $ or % in the new URL is escaped too, because both start back-references and variables there. The NE flag stops Apache from encoding the new URL a second time, and QSD drops the query string.
    • Apache .htaccess, Redirect. The Redirect directive of mod_alias is the simplest form. It matches the old path and everything below it, so Redirect /blog also sends /blog/post to the same place under the new path, and the first matching line wins. The generator therefore sorts longer paths first. Redirect cannot match a query string or several host names and appends the rest of the path to the new URL, so the tool switches back to RewriteRule when your list needs that, and tells you why.
    • Nginx. Each old path gets an exact location = block with a return directive, or a regular expression location when trailing slashes should match too. nginx does not add the query string to a return on its own, so the tool appends $is_args$args when you want it kept. For long lists, the map style keeps all paths in one lookup table; note that map compares plain strings without regard to case.
    • Netlify. The _redirects file takes one rule per line with old path, new path and status. Netlify matches paths with and without a trailing slash anyway, passes query strings on for 301 and 302, and its docs say 307 is not supported, so the tool writes 302 for 307 and 301 for 308.
    • Vercel. The redirects array in vercel.json uses permanent: true for 308, false for 307, and statusCode for 301 or 302. Vercel allows up to 2,048 redirects there. Characters with a special meaning in the source pattern are escaped.
    • Cloudflare. Bulk Redirects import a CSV file with source URL, target URL, status and Preserve query string. The source needs your host name but no scheme, so one rule covers http and https, and it cannot contain a query string.

    Chains and loops

    A chain is a redirect that lands on another redirect: /a goes to /b, and /b goes to /c. It works, but every hop costs time, and Google says its crawlers follow up to 10 hops by default, and other Google products may have different limits. A loop never ends: /a goes to /b and /b back to /a, or /page goes to /page/ while the rule also matches /page/. The checker follows every rule through your whole list, reports chains with their full path and loops as errors, and Fix chains points each old URL straight at its final address. Duplicate old URLs are kept once, because a server only ever uses one of them.

    After a move, update internal links, canonical tags and your sitemap to the new URLs, so that redirects only catch old links from outside. The broken link checker finds links on a page that still point to dead addresses, and the Hreflang Tag Generator should list the new URLs if your site has language versions.

    When you cannot change the server

    Some hosting gives you no redirect settings at all. The HTML page format writes a small page for each old URL with a meta refresh and, for permanent moves, a JavaScript fallback. Be aware of what you give up: the old URL still answers with status 200, the status code you picked does not apply, and Google interprets an instant meta refresh as permanent and a delayed one as temporary. It only sees a JavaScript redirect if rendering the page succeeds, which is why Google advises JavaScript redirects only when server-side and meta refresh redirects are not possible.

    How to use the redirect generator

    1. 1Paste your old and new URLs, one pair per line, for example two columns copied from a spreadsheet.
    2. 2Choose the redirect type and whether the query string of old links should be passed on, and fix anything the checks report.
    3. 3Pick your server or platform, copy or download the rules, add them to your configuration and test a few old URLs before you rely on them.

    Frequently asked questions

    Should I use a 301 or a 302 redirect?

    Use 301 or 308 when a page has moved for good, and 302 or 307 when the old URL will come back. Google uses a permanent redirect as a strong signal that the new URL should be shown in search results, and a temporary one as a weak signal, so it may keep showing the old URL.

    What is the difference between 301 and 308?

    Both mean the page moved permanently, and Google treats them the same. The difference is the request method: after a 301 a browser may turn a POST into a GET, after a 308 it must not. The same goes for 302 and 307 among the temporary codes. For normal pages either one works.

    How many redirects in a row does Google follow?

    Google says its crawlers follow up to 10 redirect hops by default, and other Google products may have different limits. Each extra hop also slows visitors down, so point every old URL straight at its final address. The checker flags chains and offers to fix them in one click.

    Where do I put the .htaccess rules?

    In the .htaccess file in the root folder of your site, the one that serves the old URLs. The RewriteRule version needs mod_rewrite to be enabled. If you can edit the main server configuration, rules there work too, but the path pattern then starts with a slash.

    Do redirects keep the query string?

    It depends on the server and the rule. Apache Redirect always passes it on, a RewriteRule passes it on unless you add QSD, nginx passes it on only if you add $is_args$args, and Cloudflare Bulk Redirects only with Preserve query string. The option above writes the right setting for each format where one exists.

    Is a meta refresh as good as a server redirect?

    No. The page still answers with status 200 and the browser jumps afterwards. Google reads an instant meta refresh as a permanent redirect and a delayed one as temporary, and it only sees JavaScript redirects if rendering the page works. Use it only on hosting where you cannot set up real redirects.