Magento category urls infinite redirect

Magento category urls infinite redirect

August 22, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento category urls infinite redirect

Magento Category URLs Infinite Redirect Loop

In this post, we’ll diagnose and solve an issue where changing category URL suffixes in Magento leads to an infinite redirect loop.

The Problem: Trailing Slash Redirection

You’ve edited the SEO settings under System > Configuration > Catalog > Search Engine Optimizations to add a trailing slash (/) to your category URLs. However, when attempting to access any category (e.g., www.example.com/gifts/), you encounter an infinite redirect loop with Error 310: Too Many Redirects.

A CURL command reveals that the server is issuing a 301 permanent redirect to the same URL, creating an endless cycle. The Apache error log shows lines like:

strip per-dir prefix: /var/www/blah/app-core/index.php -> index.php

Possible Causes and Solutions

1. Core Magento Configuration

The issue might stem from conflicts in core Magento configuration or customization.

Check if the following settings are correctly configured:

  • System > Configuration > General > Web
    • Base URL (Web)
    • Base Link URL (Websecure)

Ensure there is no double trailing slash (//) and that it matches your website’s actual URL structure.

2. htaccess File

Scan your .htaccess file for any conflicting rules related to trailing slashes or category redirects.

Look for lines like:

RewriteRule ^([^/]*)/?$ /index.php?/$1 [L]

If present, replace the question mark (?) with a dollar sign ($). This ensures that the trailing slash is not considered part of the match and avoids the redirect loop:

RewriteRule ^([^/]*)/ $ /index.php?/$1 [L]

3. Custom Extensions and Themes

If you’re using third-party extensions or a custom theme, they might interfere with the URL rewriting process.

  • Disable all custom plugins temporarily to rule out conflicts.
  • Switch back to the default Magento Luma theme temporarily for testing.

Conclusion: Re-indexing and Clearing Cache

The most common solution is often overlooked: ensuring proper index management after modifying SEO settings.

  1. Re-index Data: Go to System > Index Management and reindex all indexes, especially those related to URLs like URL Rewrite Management or Category Flat Data.

  2. Clear Cache: After reindexing, clear the Magento cache by running:

    php bin/magento cache:clean
    
  3. Flush Browser Caches: Clear your browser’s cache and try accessing the category URLs again.

If the issue persists after following these steps, reach out to Magento support or consult the community forums for further assistance.

Remember to always backup your site before making significant configuration changes.

For more advanced SEO practices in Magento, visit Laravel Company.

Catalog Performance Themes Configuration

Our network