Developer Tools

.htaccess Redirect Generator

Correct Apache rules for 301/302 redirects, domain moves, HTTPS and www canonicalization.

Generate Apache rules

After deploying, verify the redirect with the Redirect Checker — it should be exactly one hop.

About the .htaccess Redirect Generator

The .htaccess Generator writes clean Apache snippets for the six most common redirect jobs: single page moves, full domain migrations, force-HTTPS, www/non-www canonicalization and wildcard folder redirects — each as 301 or 302, using mod_rewrite with the correct conditions and flags.

Rules are generated locally in your browser. Deploy, then confirm with the Redirect Checker that old URLs reach their target in a single hop and with the Status Checker that nothing else broke.

In the directory the rules should apply to — usually the web root (public_html or htdocs). Rules cascade: a rule in the root affects all subdirectories unless overridden. Always keep a backup before editing; one typo can 500 the whole site.

301 (permanent) for anything that moved for good — it transfers SEO signals. 302 (temporary) only for short-lived situations like A/B tests or maintenance detours, where the original URL will come back.

Every hostname/protocol variant of your site (http, https, www, non-www) should collapse into exactly one canonical form with a single 301 — otherwise you create redirect chains and split link equity across duplicates.