ERR_TOO_MANY_REDIRECTS issue after Magento2 install, possible Ubuntu virtual host issue

ERR_TOO_MANY_REDIRECTS issue after Magento2 install, possible Ubuntu virtual host issue

October 1, 2026 · Illustrated author avatarBy Stefan Bogdanescu
ERR_TOO_MANY_REDIRECTS issue after Magento2 install, possible Ubuntu virtual host issue

** ERR_TOO_MANY_REDIRECTS issue after Magento2 Installation on Ubuntu: A Comprehensive Walkthrough **

Installing Magento2 on an Ubuntu server can be a straightforward process when following the official documentation. However, like many developers, you might encounter unexpected issues post-installation that hinder the smooth operation of your e-commerce platform.

Understanding ERR_TOO_MANY_REDIRECTS Error in Magento2

The ERR_TOO_MANY_REDIRECTS error typically occurs due to a misconfiguration in your server settings or .htaccess file. It happens when your browser gets stuck in an infinite loop of redirects, unable to reach the intended destination.

In your case, after successfully installing Magento2 and navigating to your domain (e.g., nfcshop.ca), you’re met with this frustrating error message instead of seeing your newly configured storefront.

Analyzing Your Current Configuration

Let’s break down the key elements in your current setup and identify potential areas for improvement.

Virtual Host Configuration Analysis

Your nfcshop.ca.conf file seems to be correctly configured, with the primary domain name (nfcshop.ca) and DocumentRoot pointing to your Magento installation folder (/var/www/magento).

However, the Redirect permanent / http://nfcshop.ca/ line suggests that you’ve set up a redirect from the root directory of your site. This could potentially create an infinite loop if not properly managed.

.htaccess File Review

Your .htaccess file contains basic security settings using the Order deny,allow directive to prevent unauthorized access to specific files or directories within your Magento installation. While this is generally recommended for e-commerce sites, it doesn’t appear to be causing the redirect issue directly in this context.

Possible Causes and Solutions

1. Incorrect Base URL Configuration

The most common culprit behind ERR_TOO_MANY_REDIRECTS errors in Magento2 lies within your store’s base URL configuration. During installation, you should have provided the correct domain name for your site (e.g., http://nfcshop.ca).

If this information was incorrectly entered or hasn’t been saved correctly to the database, it can lead to inconsistent redirect behavior.

To verify and update your base URL:

  1. Log in to your Magento2 admin panel.
  2. Navigate to Stores > Configuration > General > Web.
  3. Check the Base URLs for both Unsecure and Secure configurations.
  4. Ensure they match your actual domain name (e.g., http://nfcshop.ca) without any trailing slashes or extra characters.

2. Incorrect Rewrite Rules in .htaccess

While you’ve already implemented a simple .htaccess file, it’s essential to review the default Magento .htaccess file located at <Magento_Installation_Folder>/.htaccess.dist.

Compare this with your existing .htaccess and ensure all necessary rewrite rules are intact for Magento2’s proper functioning. Common issues include:

  • Incorrect or missing RewriteEngine On directive.
  • Misplaced or missing RewriteBase / line, which should be at the top of the file.
  • Incorrect syntax or missing RewriteRule entries for rewriting URLs.

Magento2 requires symbolic links to be created during installation for smooth operation. If these links haven’t been resolved correctly, it could lead to inconsistencies in URL redirection.

You can verify and resolve symbolic links using the command line:

  1. Navigate to your Magento installation directory: cd /var/www/magento
  2. Use the following commands to check and resolve symbolic links:
find . -type l -exec readlink {} \;
ln -s /usr/bin/php7 /usr/local/bin/php

4. Incorrect Virtual Host File Ownership

Ensure that your nfcshop.ca.conf file has the correct ownership and permissions set up. The Apache user (usually www-data on Ubuntu) should have read and write access to this file.

You can use the following commands to set the appropriate ownership:

sudo chown www-data:nfcshop /etc/apache2/sites-available/nfcshop.ca.conf
sudo chmod 644 /etc/apache2/sites-available/nfcshop.ca.conf

Conclusion: Resolving ERR_TOO_MANY_REDIRECTS Issue in Magento2

In most cases, addressing the issues mentioned above—specifically verifying and updating your base URL configuration—should resolve the ERR_TOO_MANY_REDIRECTS error you’re encountering.

Remember that proper testing is crucial after making any changes to your server configuration or .htaccess file. Always test in multiple browsers and clear your cache to ensure a clean read of the updated files.

If you continue facing difficulties, consider seeking assistance from experienced Magento2 developers or reaching out to Laravel Company for professional guidance on resolving complex server-side issues affecting your e-commerce platform’s performance.

Magento 2 Configuration Errors

Our network