No Signup Unlimited Usage Real Data 100% Free Privacy First Fast Results Export Reports Mobile Friendly

.htaccess Redirect Generator

Generate WWW/non-WWW, HTTP→HTTPS and 301 redirect rules for Apache .htaccess.

Fetching live data…

Quick answer

The .htaccess Redirect Generator is a free, in-browser tool that writes correct Apache mod_rewrite rules for the redirects every site eventually needs — forcing HTTPS, choosing between WWW and non-WWW, and setting up single-page 301 redirects. Apache rewrite syntax is easy to get wrong, and a small mistake can break a whole site, so the tool generates tested, properly escaped rules you can paste into your .htaccess file. Everything runs locally in your browser.

How it works

  1. Configure the redirects you need — HTTPS, WWW preference, or specific old-to-new URL pairs.
  2. Enter your domain and any source/target paths.
  3. Generate the rule block and copy it.
  4. Paste it into the .htaccess file in your site's root and save.

What it generates

  • HTTP → HTTPS redirect — force every request onto the secure version of your site.
  • WWW ↔ non-WWW — canonicalize to either www. or the bare domain.
  • 301 page redirects — permanently point an old URL to a new one.
  • RewriteEngine setup — the required RewriteEngine On and condition lines.
  • Correct flags[R=301,L] so redirects are permanent and processing stops cleanly.
  • Copy-ready block — properly ordered rules with no missing escapes.

Common use cases

  • HTTPS migration — send all traffic to the secure URL after installing an SSL certificate.
  • Choosing a canonical host — avoid splitting authority between WWW and non-WWW.
  • Moving a page — preserve rankings when a URL changes by redirecting it with a 301.
  • Site restructure — map a batch of old paths to their new locations.

Example

To force HTTPS, the tool outputs a block such as RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
— paste it at the top of your .htaccess and every request is upgraded to HTTPS.

Frequently asked questions

Is the .htaccess Redirect Generator free?

Yes — completely free, with no signup. It runs in your browser and never stores what you enter.

Will this work on every server?

These rules are for Apache with mod_rewrite enabled (the most common shared-hosting setup). Nginx and IIS use different syntax. After deploying, confirm the hops with the Redirect & HTTP Status Checker and verify your certificate with the SSL Certificate Checker.

Should I use 301 or 302?

Use a 301 for permanent moves so link equity transfers; use a 302 only for temporary changes. Our 301 vs 302 redirects guide explains when to use each, and the HTTPS migration guide covers the full HTTPS switch.

Learn & Resources

Guides, tips and tutorials hand-picked for this tool — go from running a check to actually fixing it.

On-Page SEO
Jul 10, 2026 · 15 min read

What Is SEO? A Complete Guide for Beginners

SEO is how you make a website rank higher in search engines so it earns free, organic traffic. This complete beginner's guide explains what SEO is, how search engines work, the four pillars (keyword research, on-page, technical and off-page), GEO for AI search, and a simple step-by-step roadmap you can start today.

Read article →