SSL on Magento 2

How to apply SSL on Magento 2

Enabling SSL on Magento 2 for your store is a crucial step for ensuring that your data and your customers’ information are transmitted securely over the internet. Here’s a step-by-step guide to enable SSL on your Magento 2 store:

  1. Log into the Magento Admin Panel:

    • Access your Magento 2 admin panel by going to your website’s URL followed by /admin (or the custom admin path if you’ve changed it).
  2. Navigate to Stores Configuration:

    • In the Magento Admin Panel, navigate to Stores > Settings > Configuration.
  3. Access the Base URLs Settings:

    • Under the General section in the left sidebar, click on Web.
  4. Update the Base URLs (Secure):

    • Open the Base URLs (Secure) tab.
    • Ensure that the “Use Secure URLs on Storefront” option is set to “Yes”.
    • Make sure that the “Use Secure URLs in Admin” option is also set to “Yes”.
    • In the “Secure Base URL” field, change your website’s URL to start with https://. For example, if your current base URL is http://www.yourdomain.com, update it to https://www.yourdomain.com.
    • If you have static content and media files stored on separate servers, ensure their URLs start with https:// as well in the respective fields.
  5. Enable HTTP Strict Transport Security (HSTS) (Optional but recommended):

    • Enabling HSTS tells browsers that your site should only be accessed using HTTPS. This step might require additional configuration on your server or through Cloudflare if you’re using it. You’ll typically need to add a header in your web server configuration or through the Cloudflare dashboard under SSL/TLS > Edge Certificates, enabling “Always Use HTTPS” and configuring HSTS settings.
  6. Save the Configuration:

    • After making the necessary changes, click on the “Save Config” button at the top of the page.
  7. Flush Magento Cache:

    • Navigate to System > Tools > Cache Management.
    • Click on the “Flush Magento Cache” button.
    • You might also need to flush other caches and reindex if prompted. To reindex, go to System > Tools > Index Management and ensure all indices are up to date.
  8. Test Your Configuration:

    • Visit your website and observe the URL; it should now begin with https://.
    • Try accessing your site with http:// and ensure it redirects to https://.
    • Use an SSL Checker tool online to verify that your SSL certificate is correctly installed and recognized.

If you’re using Cloudflare, make sure that the SSL/TLS encryption mode is correctly set up in your Cloudflare dashboard to match your Magento configuration, ensuring seamless SSL certificate functionality.

Remember, the exact navigation and names of the settings can slightly vary depending on the version of Magento 2 you are using. If you encounter any issues, checking Magento’s official documentation or consulting with a Magento specialist is advisable.