Magento 2: “The store that was requested wasn't found. Verify the store and try again.”

Magento 2: “The store that was requested wasn't found. Verify the store and try again.”

July 5, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 2: “The store that was requested wasn't found. Verify the store and try again.”

Solving the “The store that was requested wasn’t found” Error in Magento 2

As an experienced Magento developer, I often encounter issues like the one you’re facing - the dreaded “The store that was requested wasn’t found. Verify the store and try again.” error when switching between store views. Let’s dive into your setup and find a solution to this problem.

Understanding Your Current Setup

You have configured two store views, each with its own domain: example.com for the English view and example.it for the Italian view. You’ve also correctly added environment variables in your .htaccess file to direct traffic based on the incoming domain. However, when you switch between views, Magento seems unable to redirect properly.

The Core Issue

The problem lies in how Magento handles store switching and URL redirection. When you switch from one store view to another, Magento constructs a URL that includes the ___store parameter. This URL is then used for the redirection. However, if there’s an issue with this constructed URL or the target store code isn’t found, you encounter the error.

What We Know So Far

From your tests, we’ve learned two key things:

  1. Hardcoding the redirect URL in the SwitchAction controller works when switching from Italian to English.
  2. This suggests that Magento is having trouble either finding the target store or constructing the correct redirection URL when you switch views.

Troubleshooting Steps

Step 1: Check Your Store Configuration

Ensure that both your stores (English and Italian) are active and that their codes (en and it) match exactly with what’s configured in Magento admin. You can find this under Stores > Settings > All Stores.

Step 2: Verify Your Domain Setup

Double-check if the base URLs for each store view are set correctly:

  • For English (example.com): Store > Configuration > General > Web > Base URLs
  • For Italian (example.it): Same path, but select the “Italian” store view from the top-right corner dropdown.

The base URLs should match exactly with your domain names.

Step 3: Check Your MAGE_RUN_TYPE Environment Variable

Ensure that both of these lines in your .htaccess file are properly set:

SetEnvIf Host ^(.*)\.example\.com MAGE_RUN_TYPE=store
SetEnvIf Host ^(.*)\.example\.it MAGE_RUN_TYPE=store

The MAGE_RUN_TYPE should be set to “store” for both domains.

Step 4: Debug the URL Construction

Add some debug statements in your SwitchAction.php controller around line 106, just before the redirection occurs:

$redirectUrl = $requestedUrlToRedirect;
Zend_Debug::dump($requestedUrlToRedirect);
Zend_Debug::dump($targetStoreCode);

This will output the constructed URL and the target store code. Check if they match what you expect.

Likely Solutions

Solution 1: Clear Magento Cache

Sometimes, outdated cache data can cause issues with store switching. Try clearing all caches from the admin panel (System > Tools > Cache Management).

Solution 2: Re-index Your Data

Magento relies heavily on indexed data for various operations. If your site is out of sync, you might face issues like this one.

To reindex all data, use the following command in your terminal:

php bin/magento indexer:reindex

Solution 3: Check Your rewrite.xml and .htaccess

Ensure that your URL rewrites are properly set up. You can check your app/etc/config.local.xml file for the correct configuration of your domains.

Also, ensure there are no conflicting rules in your .htaccess file or RewriteBase is correctly set to /.

Conclusion

In most cases, one of the solutions mentioned above should resolve your issue. However, if you’re still facing problems, I recommend using Magento’s built-in log files for more detailed debugging.

Remember, Magento 2 requires a lot of configuration and fine-tuning to work smoothly. Always ensure that your base URLs, domains, and environment variables are correctly set up.

If you need further assistance or want to explore how we can help optimize your Magento setup, feel free to contact us at LaravelCompany. We offer professional Magento development services tailored to meet your business needs.

Magento 2 Configuration Errors

Our network