Force website HTTPS with .htaccess

Adding this code above all other code in .htaccess file will force visitor to https instead of http.

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^domain.\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.domain.com/$1 [R,L]

replace ‘domain.com’ with your domain name.

Tagged: Tags:

Leave A Comment?