Create Apache .htaccess redirect rules without memorising the syntax: redirect a single URL or a whole site to a new domain, force HTTPS, and add or remove www — with 301 or 302 status. Copy the rules straight into your .htaccess. Built in your browser.
htaccess Redirect Generator helps you optimise and publish with confidence, producing clean, standards-friendly output you can paste straight into your site.
Use 301 for permanent moves (passes SEO value) and 302 for temporary ones.
No — .htaccess is Apache-specific; Nginx needs server-block rewrites.
No — the rules are generated in your browser.
RewriteEngine On
# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect a single URL
Redirect 301 /old-page https://example.com/new-page