How to automatically redirect a website to SSL

To set automatic url redirection from http://domain.com to https://www.domain.com

  1. Go to your Filemanager
  2. Find .htaccess or create a file new file

Put this content in .htaccess

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]
Please rate this article to help us improve our Knowledge Base.

2 0




Hello , talk to a hosting specialist today and discover which options will work best for you.

+255 734 666 100