How to redirect a site to https using htaccess

If you want to redirect your domain from HTTP to HTTPS, you can achieve this using   If you are not using Cloudflare or any proxy server, use the below code in your .htaccess file RewriteCond %{HTTP_HOST} !^www.(.*)$ [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{HTTPS} =off RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] If you are using Cloudflare ...