Redirection from http to https through .htaccess

If you want to redirect domainname.com and www.domainname.com to https://www.domainname.com, please use below codes in .htaccess file of the domain:

RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule (.*) https://www.domainname.com /$1 [R,L]

Leave a Reply

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