How do I Force my Website to use SSL?

http-to-https-with-htaccess
http-to-https-with-htaccess

What is htaccess ?

htaccess is a configuration file for use on web servers running the Apache Web Server software.

Forcing all website traffic to use HTTPS

Use the following code in your .htaccess file

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

Forcing a specific domain to use HTTPS

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

 

Common htaccess Rules

Arul M Joseph — Web Designer Kozhikode Kerala

Written by

Shopify Partner & Web Designer  ·  Kozhikode, Kerala  ·  Since 2011

Arul M Joseph is a certified Shopify Partner and freelance web designer based in Kozhikode, Kerala, India — with 14+ years of professional experience since 2011 and 500+ websites delivered across India, UAE, UK, US, and Australia. He founded arulmjoseph.com as a solo practice in 2011, growing it into a government-registered MSME (Udyam No: UDYAM-KL-08-0062793) serving small businesses, eCommerce brands, and global clients. His work spans Shopify store development, WordPress websites, WooCommerce stores, Laravel web applications, and technical SEO. Featured projects include the SDE Calicut University portal, Revathi Kalamandir, and actor VK Sreeram's official website. Based in Kozhikode, Kerala. Verified on GoodFirms and the Shopify Partner Directory.