Home › Tools › Technical SEO Tools › Htaccess Redirect Generator
Free Technical SEO Tool

Htaccess Redirect Generator

Paste old and new URLs, one pair per line, and get redirect rules ready for your Apache or LiteSpeed .htaccess file. Chains are flattened, loops are caught, and query string URLs are handled correctly.

Your Redirects

Your .htaccess Rules

0Redirects
0Chains Fixed
0Problems

      
Copied!
Before you paste
  • Download a backup of your current .htaccess file
  • In WordPress, paste the rules above the # BEGIN WordPress line
  • Test a few old URLs in a private window afterwards

What Is an Htaccess Redirect Generator?

When you change a URL, delete a page or move to a new site structure, a redirect sends visitors and search engines from the old address to the new one. On Apache and LiteSpeed hosting, which includes most shared hosting, these rules live in a file called .htaccess at the root of your site.

Writing the rules by hand is slow and easy to get wrong. This generator turns a simple list of old and new URLs into correct rules, and checks the list for problems like chains, loops and duplicates first.

How to Use the Redirect Generator

  1. Paste your redirects, one per line: the old URL, a space, then the new URL.
  2. Enter your domain so new URLs written as paths become full URLs.
  3. Choose 301 for permanent moves. Use 302 only when the old page is coming back.
  4. Pick a rule style. RedirectMatch redirects the exact URL only, which is the safest choice.
  5. Copy the rules into your .htaccess file, near the top, then test a few old URLs.

Redirect Types and Rule Styles

OptionWhat it does
301 and 308Permanent. Google shows the new URL in results and passes signals to it
302Temporary. Google keeps showing the old URL
RedirectMatchMatches one exact path, with or without the trailing slash
RedirectMatches the path and everything below it, and keeps the rest of the path
RewriteRuleNeeded for old URLs with query strings, and for HTTPS or www rules

Google explains how it treats each status code in redirects and Google Search, and the Apache manual covers Redirect and RedirectMatch in detail. Apache runs the first rule that matches, so the order of your rules matters.

Tips for Safe Redirects

Learn More About Redirects

Understand every status code in HTTP status codes for SEO, plan a safe switch with the SEO impact of moving to HTTPS, and manage redirects in code with our redirect manager in PHP. Moving pages around? Update your sitemap with the XML sitemap generator.

Frequently Asked Questions

1Should I use a 301 or 302 redirect?

Use a 301 when the move is permanent, which is almost always the case for SEO. Google then shows the new URL in results. Use a 302 only when the old page will come back soon.

2Where do I put the redirect rules?

Paste them near the top of the .htaccess file in your site root. In WordPress, put them above the BEGIN WordPress block so WordPress does not handle the URL first.

3Why do old URLs with a question mark not redirect?

Simple Redirect rules cannot match query strings. The generator detects old URLs with a question mark and writes RewriteRule code with a query string condition instead.

4What is a redirect chain?

A chain is when page A redirects to B and B redirects to C. It slows visitors and wastes crawling. Turn on chain fixing and the tool sends A straight to C.

Related Articles

More Free Technical SEO Tools

See all technical seo tools →  |  Browse every free tool →