Magento 2 SSL & HTTPS Configuration

🔒 Magento 2 SSL & HTTPS Configuration – Secure Your Store with HTTPS

Want to protect your customers’ data and boost SEO rankings? Setting up HTTPS in Magento 2 is a must! HTTPS ensures secure connections for everything from customer logins to checkout pages. Let’s configure it the right way.

🌐 Prerequisites

  • Your domain must have an SSL certificate installed (via Let’s Encrypt, cPanel, or hosting provider).
  • Ensure your web server (Apache/Nginx) is properly set to redirect HTTP to HTTPS.

⚙️ Enable HTTPS in Magento Admin

Login to your Magento 2 admin and follow these steps:

  1. Go to Stores > Configuration
  2. Navigate to Web > Base URLs (Secure)
  3. Update the URL to: https://yourdomain.com/
  4. Set Use Secure URLs on Storefront to Yes
  5. Set Use Secure URLs in Admin to Yes
  6. Save Config and clear cache

💻 Command Line Configuration (Optional)

You can also enable HTTPS via the CLI:

php bin/magento config:set web/secure/use_in_frontend 1
php bin/magento config:set web/secure/use_in_adminhtml 1
php bin/magento cache:flush

Try It Now

🔁 Force HTTPS via .htaccess (Apache)

If your server runs Apache, you can redirect all traffic to HTTPS by modifying your .htaccess:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Try It Now

🔎 Verify SSL

  • Visit your website in a browser and check for the secure padlock icon.
  • Use online tools like SSL Labs to test your HTTPS setup.

✅ Summary

With HTTPS enabled, your Magento 2 store is more secure and trusted by customers. Plus, Google rewards secure sites with better rankings. So go ahead—lock it down with SSL!