If we have added an SSL certificate to your domain, we can force all visits to your site to use HTTPS to ensure your traffic is secure. This post shows examples on how to do this.

The following forces any http request to be rewritten using https. For example, the following code forces a request to http://example.com to load https://example.com. It also forces directly linked resources (images, css, etc.) to use https:

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

Hope this help you to redirect from http to https

Leave a Reply

Your email address will not be published.