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
- Paste your redirects, one per line: the old URL, a space, then the new URL.
- Enter your domain so new URLs written as paths become full URLs.
- Choose 301 for permanent moves. Use 302 only when the old page is coming back.
- Pick a rule style. RedirectMatch redirects the exact URL only, which is the safest choice.
- Copy the rules into your
.htaccessfile, near the top, then test a few old URLs.
Redirect Types and Rule Styles
| Option | What it does |
|---|---|
| 301 and 308 | Permanent. Google shows the new URL in results and passes signals to it |
| 302 | Temporary. Google keeps showing the old URL |
RedirectMatch | Matches one exact path, with or without the trailing slash |
Redirect | Matches the path and everything below it, and keeps the rest of the path |
RewriteRule | Needed 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
- Redirect to the closest match, not the home page. A redirect to an unrelated page may be treated as a soft 404.
- Avoid chains. Each extra hop slows visitors down. This tool points every old URL straight to its final page.
- Update internal links too. Redirects are a safety net. Your menus and posts should link to the new URLs directly.
- Keep redirects in place for as long as old links and bookmarks may still be used. For a site move that means years.
- Not on Apache? Nginx does not read
.htaccess. Ask your host or use a redirect plugin instead.
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.