Zahid Awais Get a free audit

Free htaccess redirect generator

Create clean 301 and 302 redirect rules for Apache .htaccess without memorizing mod_rewrite syntax.

By Zahid Awais · Technical SEO tools · Free, private, no sign-up

Result
0Rules
301Status
0Warnings

    The free htaccess redirect generator runs in your browser, needs no sign-up and never sends what you type anywhere.

    Quick answer

    This htaccess redirect generator writes Apache rules for page, bulk, domain, HTTPS and www redirects. Rule of thumb: use 301 for permanent moves so Google treats the new URL as canonical, 302 only for short tests, point each old URL straight to its final destination, and keep redirects live for at least a year.

    What is a htaccess redirect generator?

    An htaccess redirect generator is a tool that converts old and new URLs into Apache directives such as Redirect, RedirectMatch or RewriteRule. It strips your old URL to a path, escapes special characters for exact matching, and adds the status code (301 permanent or 302 temporary) and the flags Apache needs.

    How do you use the Htaccess Redirect Generator?

    How to use the Htaccess Redirect Generator: enter details, see the result and copy it
    Real screenshot of the Htaccess Redirect Generator with the steps marked.
    1. Choose the redirect type: single page, bulk list, whole domain, force HTTPS, or force www or non-www.
    2. Enter the old path or URL and the full new URL. For bulk mode paste one old and new pair per line.
    3. Pick 301 for permanent moves or 302 for temporary ones, and keep exact match on for single pages.
    4. Copy the rules and paste them near the top of the .htaccess file in your site root, after taking a backup.
    5. Test the old URLs in a browser or a header checker and confirm one hop to a 200 page.

    Should I use a 301 or 302 redirect?

    Use a 301 when the move is permanent, because Google treats a permanent redirect as a strong signal that the target URL should be canonical. Use a 302 when the original page will come back, such as a short promotion or maintenance. Google explains the difference in its redirects and Google Search guide.

    How long should I keep 301 redirects?

    Keep 301 redirects for at least 1 year, and longer if old URLs still get links or traffic. Google recommends this so it can transfer signals and so users following old links still land on the right page. Many SEOs never remove redirects for pages that earned backlinks.

    Why is my htaccess redirect not working?

    The most common cause is that .htaccess is ignored because AllowOverride is set to None, or mod_rewrite is not enabled. Other causes are rule order (a WordPress block catching the request first), a cached old redirect in your browser, or a typo in the path. Test in a private window after each change.

    Quick reference

    DirectiveMatchesBest for
    Redirect 301Path prefix, and appends the rest of the pathMoving a whole folder
    RedirectMatch 301Regular expressionOne exact page or a pattern
    RewriteRule [R=301,L]Regex plus conditions on host, HTTPS or queryDomain, HTTPS, www and query string redirects
    302 or tempSame as above, temporary statusShort tests and maintenance
    410 or gonePage removed with no replacementDeleted content you do not want back

    Worked example

    Example

    Example: you rename /blog/seo-tips/ to /blog/seo-tips-2026/. With exact match on and 301 selected the tool outputs RedirectMatch 301 ^/blog/seo-tips/?$ https://example.com/blog/seo-tips-2026/. A request for /blog/seo-tips returns one 301 hop and the new page loads with a 200 status.

    Frequently asked questions

    Where do I put redirect rules in .htaccess?

    Put them near the top of the .htaccess file in your site root, above CMS blocks such as the WordPress rewrite section. Apache processes RewriteRule directives in order, so a catch all rule placed first can swallow your redirect. Always keep a backup of the original file.

    Does Redirect 301 match subpages too?

    Yes. The plain Redirect directive matches a path prefix and appends the rest, so Redirect 301 /shop https://example.com/store also sends /shop/item to /store/item. If you only want one page to move, use RedirectMatch with a regex anchored by ^ and $, which this tool does when exact match is on.

    How do I redirect a URL with a query string in htaccess?

    Redirect and RedirectMatch ignore the query string, so you need mod_rewrite with a RewriteCond on %{QUERY_STRING}. Enter the old URL including the question mark and this tool writes the condition for you, plus a trailing question mark on the target to drop the old parameters.

    Can too many redirects slow my site?

    Each redirect adds a round trip, so chains are what hurt. Point every old URL straight to the final URL instead of hopping through older redirects. A few thousand simple rules are usually fine, but very large lists are better handled in the main server config or at the application level.

    Do redirects pass link equity?

    Yes, a permanent redirect to a relevant page lets Google consolidate signals, including links, onto the new URL. What matters is relevance: redirect each old page to its closest equivalent. Sending many unrelated pages to the home page can be treated as a soft 404, so those links may not help.

    Does this tool work for Nginx or IIS?

    No. The output uses Apache syntax and only works on Apache or LiteSpeed servers that read .htaccess files. For Nginx use our Nginx redirect generator, and for very large migrations build a redirect map first. The tool runs fully in your browser and sends nothing to a server.

    Sources

    Facts checked against these official pages. Read how I check facts in my editorial policy.

    Related free tools

    All 104 tools

    Redirect Map Generator

    A redirect map generator is a tool that builds the old URL to new URL table you need before a site migration.…

    Coming 10 Oct

    Nginx Redirect Generator

    An Nginx redirect generator is a tool that turns old and new URLs into Nginx configuration such as location =…

    Coming 12 Oct

    Htaccess Generator

    An htaccess generator is a tool that writes per directory Apache configuration so you do not have to remember…

    Coming 16 Oct

    Want a full audit instead?

    Send your website and I will check it for you, free.

    Get my free audit
    Chat on WhatsApp