Config
.htaccess Redirect Generator
Generate Apache redirect and canonical rules you can paste in.
# Generated by HostingSwift — review before use
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]Generated locally in your browser. Free.
About this tool
Free .htaccess generator. Create safe redirect, HTTPS and www/non-www canonical rules for Apache, with a plain explanation of each line.
Frequently asked questions
Will this break my site?
The rules are conservative, but always back up your .htaccess before editing it.
Do you support wildcards?
Yes, the redirect tools support pattern-based rules.
Does this work on nginx?
No, this produces Apache rules. nginx uses a different format.
Need more than a tool?
HostingSwift runs the servers too — VPS, web hosting, email, DNS and streaming, with a free tier to start.