Redirect Map Generator for .htaccess and Nginx

Turn a list of old and new URLs into 301 redirect rules, and catch chains and loops first.

Paste your old and new URLs and get ready-to-use 301 redirect rules for Apache (.htaccess) or Nginx, or a CSV for a redirect plugin. The tool also catches duplicate entries, redirect chains and loops before they reach your live site.

Options

    Apache rules go near the top of the .htaccess file in your site's root folder, above the WordPress block. Nginx rules go inside your server block. Keep a backup of the file before you change it.

    Embed this tool on your site

    Free to use. Paste this code into a Custom HTML block or any web page and keep the credit line under it.

    Advertisement

    When you need a redirect map

    Any time a URL changes, the old address should send visitors and search engines to the new one: when you rename a post, change your permalink structure, merge two articles, move to a new domain or rebuild a site. Without redirects, links from other sites and old bookmarks land on a 404 page, and the ranking signals the old page earned are lost.

    301 or 302?

    Use a 301 when the move is permanent, which is almost always. It tells Google to replace the old URL with the new one in search results. A 302 is for short-term moves, such as a sale page that will come back, and tells Google to keep the old URL.

    Chains and loops

    A chain happens when page A redirects to B, and B redirects to C. Each extra hop slows visitors down, and Google stops following after several hops. With “Fix redirect chains” switched on, the tool points A straight at C. A loop, where pages end up redirecting back to themselves, would make a page impossible to open, so those lines are flagged and left out until you fix them.

    Adding the rules

    • Apache: paste the rules near the top of the .htaccess file in your site’s root folder, above the “# BEGIN WordPress” block. Download a backup copy of the file first.
    • Nginx: add the rules inside the server block of your site’s configuration and reload Nginx.
    • No server access? Use the CSV with a redirect plugin, or add the redirects one by one in Rank Math or a similar plugin.

    Our guide to 301 redirects in WordPress walks through the plugin route, and finding and fixing broken links shows how to find the old URLs that need a redirect in the first place.

    Common questions

    Should I use full URLs or paths?

    Either works. Rules match the path of the old URL, so /old-page/ and https://www.example.com/old-page/ give the same result. Use full URLs for the new address when you are moving to another domain.

    Do the rules match URLs with query strings?

    Yes. Old URLs that include a query string, such as /page?id=7, get a separate rule that matches that exact query.

    Will the Apache rules also redirect pages inside a folder?

    No. Each rule matches its exact path (with or without a trailing slash), so redirecting /blog/ does not accidentally redirect every post inside /blog/.

    How long should I keep redirects?

    Keep permanent redirects for at least a year, and longer for pages that still receive visits or links. They cost almost nothing to keep.

    Advertisement