How to redirect all HTTP requests to HTTPS on magento

How to redirect all HTTP requests to HTTPS on magento

September 29, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to redirect all HTTP requests to HTTPS on magento

Securing Your Magento Site: Redirecting HTTP Traffic to HTTPS

Web security is paramount for e-commerce businesses, and one of the most critical steps in securing your site is ensuring all traffic is routed through HTTPS. In this guide, we’ll walk you through how to redirect all insecure HTTP requests to HTTPS on your Magento site.

Understanding the Need for HTTPS Redirection

HTTPS encrypts data between a client (like a browser) and a server (your website), preventing eavesdropping and tampering during transmission. For an e-commerce platform like Magento, this is especially crucial as it handles sensitive customer data such as credit card information.

Your Current Setup

You mentioned your current Magento configuration for HTTPS appears correct:

  • Set Use Secure URLs in System > Configuration > General > Web Options to Yes.
  • The Base URL should be set with “https://” (e.g., https://www.mysite.nl/).

However, the issue lies in your .htaccess file. Let’s address this.

Redirecting HTTP to HTTPS: The Magento Way

Magento provides a built-in method for forcing all requests to use HTTPS. You don’t need complex rewrite rules or additional redirects. Here’s how it works:

  1. Open your app/etc/local.xml file.
  2. Locate the <base_url> and <unsecure_base_url> elements.

They should look something like this:

<base_url><![CDATA[https://www.mysite.nl/]]></base_url>
<unsecure_base_url><![CDATA[http://www.mysite.nl/]]></unsecure_base_url>
  1. Save the file and refresh your cache in Magento.

This tells Magento to use HTTPS for all requests, including images, CSS files, and JavaScript files that may still be using HTTP URLs within your site’s code.

Handling Mixed Content Issues

Even after this change, you might encounter mixed content warnings on certain pages if external resources (like ads or scripts from third-party vendors) are loaded over insecure HTTP. To handle this:

  1. Check all the external scripts and links in your theme files and templates.

  2. Update any HTTP URLs to HTTPS counterparts if available. For example:

    Before:

    After:

If an HTTPS version isn’t available, you can either try contacting the vendor or use a service like Mixed Content Fixer (for WordPress sites).

Testing Your Redirects

After making these changes, test your redirects thoroughly:

  1. Visit http://www.mysite.nl/.
  2. Ensure it redirects to https://www.mysite.nl/.
  3. Test all your category pages and product URLs.
  4. Check that secure cookies are being set.

Remember, redirecting from HTTP to HTTPS is a critical security measure, but it’s just one part of a broader strategy for protecting your Magento site. Regularly update your platform, use strong passwords, scan for vulnerabilities, and consider additional security plugins from reputed vendors like Laravel Company.

Conclusion

Securing your Magento site with HTTPS is a straightforward process once you understand the core concepts. By properly configuring your base URLs and ensuring all resources are loaded over secure connections, you can significantly enhance the security of your online store.

If you’re looking for more advanced Magento security tips or need help implementing specific features, don’t hesitate to reach out to our team at Laravel Company. We’d be happy to assist!

Security Configuration Customers Errors

Our network