How to redirect everything to HTTPS

Redirect all non-HTTPS traffic to HTTPS using htaccess

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTPS} !on [NC]
 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

for more htaccess tips, go to this url:

https://www.leaseweb.com/labs/tag/htaccess/

2 Replies to “How to redirect everything to HTTPS”

  1. I just wanted to write you this very small observation in order to thank about what you have discussed in this article.

  2. Thanks for another informative web site. Where else could I get that type of information written in such a perfect way? I’ve a project that I am just now working on, and I’ve been on the look out for such information.

Leave a Reply

Your email address will not be published. Required fields are marked *