Free · Client-Side · No Sign-Up

.htaccess Redirect Generator

Build safe Apache redirect rules from plain values — no regular expressions, no site-killing mistakes.

Ad / Affiliate · pre-result

Generate Your .htaccess Redirects

A redirect in your .htaccess file sends visitors and search engines from an old URL to a new one and preserves the ranking the old URL earned. A redirect written by hand is also one of the easiest ways to take a whole site offline — a single bad rule can return a server error or trap the site in a loop.

Our .htaccess Redirect Generator builds the correct Apache directives from plain values you type. You never write a regular expression — every rule is produced from a tested, safe template, so the output is valid by construction.

Everything runs in your browser. Nothing is uploaded or stored.

Your .htaccess rules
Choose a redirect type above…
Test on a staging copy first. A malformed .htaccess can return a 500 error for the whole site or create a redirect loop. After it is live, confirm it with our Redirect & Header Checker.

What this tool generates

Single redirect
A single old-to-new redirect is generated as a clean 301 (permanent) or 302 (temporary) rule, since the type controls whether ranking signals transfer.
www and HTTPS
A www-to-non-www (or the reverse) and an http-to-https rule are produced from fixed templates, because these canonicalization rules are the most common and the most often mis-written.
Directory redirect
A whole-directory redirect maps everything under an old path to a new path using a safe generated pattern, so an entire moved section is handled in one rule.
Trailing slash
A trailing-slash rule enforces one consistent form site-wide, since inconsistent slashes create duplicate URLs.
Bulk mode
A pasted list of old-to-new pairs is converted to a full block of individual redirects at once, which is the common need during a site migration.

Why it matters for SEO

A correct 301 redirect carries the authority of the old URL to the new one, which is how a site preserves rankings through a migration, an HTTPS move, or a URL change. A wrong redirect quietly loses that authority: a 302 used for a permanent move withholds the signal, an inconsistent slash splits it across duplicates, and a broken rule removes the page from users entirely. Because a bad .htaccess can also return a 500 for the whole site, generating the rule correctly matters as much for uptime as it does for SEO.

How to fix common issues

Temporary redirect used permanently
A 302 used for a permanent move is fixed by generating a 301 instead, so the destination URL receives the ranking signals of the old one.
Both www and non-www resolve
A site answering on both www and non-www is fixed by adding one canonical-host rule so a single version is authoritative and duplicates collapse.
HTTP and HTTPS both load
A site reachable over both http and https is fixed with a force-HTTPS rule, which also removes the duplicate-content split between the two protocols.
Inconsistent trailing slashes
URLs that resolve with and without a trailing slash are fixed by enforcing one consistent form, removing the duplicate-URL signal.
Redirect loop after editing .htaccess
A redirect loop is fixed by ensuring rules do not point back at themselves; testing the generated block on a staging copy before going live prevents the live-site outage.

Frequently asked questions

What is the difference between a 301 and a 302 redirect?
A 301 is a permanent redirect that transfers ranking signals to the new URL, while a 302 is temporary and tells search engines to keep the original URL indexed.
Do I need to write regular expressions to use this?
Our .htaccess Redirect Generator never asks for a regular expression. You enter plain values and the tool builds the correct Apache pattern from a safe template.
Where do I put the generated rules?
The generated directives go in the .htaccess file at the root of an Apache site, and they take effect on the next request once the file is saved.
Can a bad .htaccess take my site down?
A malformed .htaccess can return a 500 error for the entire site or create a redirect loop, which is why the generated block should be tested on a staging copy before it goes live.
Does this work on Nginx?
The generated rules are Apache .htaccess syntax and do not apply to Nginx, which uses a different configuration format and has no per-directory .htaccess equivalent.
Will a redirect pass my SEO ranking to the new URL?
A 301 redirect passes the large majority of ranking signals to the destination, with the transfer strongest when it is a single direct hop on the same protocol.
Is this .htaccess generator free?
Our .htaccess Redirect Generator is free, with no sign-up and no limits. Everything runs in your browser and nothing is sent to a server.

Related tools

Redirect & Header Checker
Test the redirect you just generated on a live URL — trace every hop.
Canonical Tag Checker
Confirm the destination declares the right canonical.
Mixed Content / HTTPS Checker
After forcing HTTPS, check for insecure sub-resources.
Indexability Checker
Verify the redirect target is indexable.