Redirect from HTTP to HTTPS SS Secure Site Print

  • https, htaccess, ssl, forward to https
  • 2

To force your website visitors to access your website using httpS:\\sitename.com  instead of http:\\sitename.com , then follow the below instructions:

 

  1. Edit or create a file known as .htaccess   in the root of your web folder (typically is  /public_html/)

    2. In the .htaccess , add the following lines:

RewriteEngine On
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


 


Was this answer helpful?

« Back

Powered by WHMCompleteSolution