How to redirect website http to https by htaccess
When we use SSL on our website for security purposes, we must write a rule for redirection HTTP to HTTPS, so it is straightforward. We can do this via the .htaccess file. There are some steps following:
Step1 : Create .htacess fileStep2 : Write the following code :
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?domain-name\.com
RewriteRule ^(.*)$ https://www.domain-name/$1 [R,L]
Step3 : In the place of domain-name, write your domain name and replace .com with your domain extension