Magento and multiple domains

Magento and multiple domains

September 16, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento and multiple domains

[BLOG_POST]

Solving Multiple Domain Setup Issues in Magento

You’re on the right track towards setting up multiple domains for your Magento store based on language. However, you’ve encountered some challenges recognizing the correct domain being accessed. Let’s dive into this issue step by step.

The Current Configuration

Your current Apache setup seems to be configured correctly with ServerAlias directives pointing to mysite.it and mysite.ru as aliases of mysite.rb.com. This is a standard way to handle multiple domains in Apache.

Identifying the Issue

You’ve noticed that even when accessing mysite.it or mysite.ru, the HTTP_HOST value remains as mysite.com. This suggests that Magento isn’t correctly recognizing the actual domain being accessed.

Understanding the Redirects

It appears that Magento itself is handling redirects rather than relying on your Apache configuration. When you deleted the project directory and Apache didn’t send a 302 redirect, it confirmed that Magento is responsible for this behavior.

The Magento Setup

Let’s review some key points in your Magento setup:

  1. Base URLs: Ensure that you’ve set both the Unsecure Base URL and Secure Base URL to the correct domain name for each store view. You can find these settings under System > Configuration > General > Web.

  2. Store Views: Each store view should correspond to a specific domain. In your case, you have one main store (mysite.com) and two more store views for mysite.it and mysite.ru.

  3. URL Rewrite Rules: Magento manages URL rewrites internally to map domains to the correct store views. You can check these rules under System > Configuration > URLs and SEO Tools > URL Rewrites.

Potential Solutions

Given that it seems like a configuration issue within Magento rather than Apache, let’s explore some troubleshooting steps:

  1. Clear Cache: Magento heavily relies on caching for performance optimizations. Clearing the cache can sometimes resolve unexpected behavior. You can do this manually under System > Cache Management or use command-line tools.

  2. Flush URL Rewrites: Sometimes, Magento might not update its URL rewrite rules properly. Flushing these rules could help: go to System > Configuration > URLs and SEO Tools > URL Rewrites > Actions. Click on “Save Config” and then “Flush URL Rewrites”.

  3. Check .htaccess File: Ensure that your .htaccess file is correctly configured, especially the RewriteBase directive.

Conclusion

Setting up multiple domains in Magento requires a careful balance of Apache configuration and internal Magento settings. While it’s not an issue with your Apache setup, you need to focus on ensuring that Magento correctly recognizes and maps the requested domain to the appropriate store view.

Remember, the key is to accurately configure the base URLs for each store view and ensure that the URL rewrite rules are properly flushed. If the issue persists, consider checking the Magento logs under var/log/ or using a tool like New Relic for more detailed performance and error tracking.

Don’t hesitate to reach out if you need further assistance with your Magento setup. We at Laravel Company specialize in Magento development and consultancy, ready to help you overcome any technical challenges that arise during your e-commerce journey.

Happy coding!

Configuration Errors

Our network