Redirect http to https and www

Updated 2026
Quick Answer

To redirect HTTP to HTTPS and non-www to www (or vice versa), add this to your .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

For the complete guide:

How Can I Redirect HTTP to HTTPS

This article has been consolidated into our How Can I Redirect HTTP to HTTPS guide for easier reference.

  • 4 Users Found This Useful

Was this answer helpful?

Related Articles

Disable error_log via htaccess

htaccess & Redirects | Updated 2026 The error_log file in your public_html directory...

When I Upload an htaccess File It Disappears

htaccess & Redirects | Updated March 2026 Your .htaccess file is there. You just can't...

htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

htaccess & Redirects | Updated March 2026 The "pcfg_openfile: unable to check htaccess...

Preserving SEO After a Weebly Migration with 301 Redirects

htaccess and Redirects | Updated July 2026 Moving off Weebly changes your URLs, and if you do...

301 Redirect

Updated 2026 Quick Answer A 301 redirect permanently sends visitors and search engines...



Save 30% on web hosting - Use coupon code Hosting30