Magento, all pages redirects to HTTPS

Magento, all pages redirects to HTTPS

August 19, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento, all pages redirects to HTTPS

Magento: Resolving All Pages Redirecting to HTTPS

If you’re facing an issue where your entire Magento site has beenredirecting all traffic to HTTPS, you’re not alone. This is a common problem that can occur due to changes in the SSL settings or misconfigurations during updates.

Understanding the Problem and Its Causes

When a link on the page points to HTTP with SEO URLs, but Magento is returning a HTTPS page with catalog URLs instead, it indicates that the base URL for your site has been changed from HTTP to HTTPS. This could be due to several reasons:

  1. SSL Certificate Installation or Update: If you recently installed an SSL certificate or updated your existing one, Magento might have automatically switched all URLs to HTTPS.

  2. Core File Modifications: Changes made to core files like .htaccess or index.php can also cause this behavior.

  3. Configuration Updates: Misconfigurations in the Magento admin panel’s store settings or system configuration can lead to unexpected redirects.

Steps to Resolve the Issue

To resolve this issue and specify which areas of the site should use HTTPS, follow these steps:

1. Check Your Base URL Settings

Log into your Magento admin panel and navigate to Stores > Configuration > General > Web.

Under the ‘Base URLs’ section, ensure that the following values are set correctly for each store view:

  • Unsecure (HTTP) Base URL: Should match your site’s original HTTP base URL.
  • Secure (HTTPS) Base URL: Should be empty if you don’t want HTTPS enforced.

2. Verify Your .htaccess and index.php Files

Open these files and double-check the following lines:

In .htaccess:

RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]

Replace example.com with your own domain.

In index.php:

// Check if the host is different from the configured one
if (empty($_SERVER['HTTP_HOST']) || $_SERVER['HTTP_HOST'] != $domain) {
    header("Location: http://{$domain}");
    exit();
}

Ensure these lines are not forcing an HTTPS redirect that you don’t want.

3. Review Your System Configuration

Navigate to Stores > Configuration > Advanced > General and check the ‘Session Cookie Settings’ and ‘Web’ sections. Ensure there are no settings enforcing HTTPS for specific areas of your site.

Best Practices: Enabling HTTPS Properly

If you do need to enable HTTPS, consider these best practices:

  1. Use a Valid SSL Certificate: Ensure you have a valid and properly installed SSL certificate that matches your domain.

  2. Configure the Base URL Correctly: Update both the ‘Unsecure (HTTP) Base URL’ and ‘Secure (HTTPS) Base URL’ in the Magento admin panel to reflect your intended base URLs for each environment.

  3. Update Your Index.php File: Modify the define('URL_SECURE_BASE', 'https://'); line to match your secure base URL if you want HTTPS enforced site-wide.

  4. Test Thoroughly: After making any changes, thoroughly test your site on both HTTP and HTTPS to ensure all links and functionality work as expected.

Remember, forcing HTTPS for your entire Magento site can have implications for SEO, third-party integrations, and user experience. It’s crucial to plan these changes carefully and test them extensively before deploying to a live environment.

Conclusion

Resolving the issue of all pages redirecting to HTTPS in Magento requires a systematic approach that involves checking multiple configuration points. By following the steps outlined above, you should be able to identify the cause of the redirection and revert your site back to its original state or enforce HTTPS selectively as required.

If the problem persists even after these checks, it might be a good idea to consult with a Magento development expert or seek support from Laravel Company. They specialize in Magento development services and can provide professional assistance tailored to your specific needs.

Catalog Admin Configuration SEO

Our network