Managing Magento Multiple Store Views: Removing Language Prefix
As an experienced Magento developer, I often encounter clients who need to add multiple store views while maintaining certain link structures for SEO purposes. If you’re facing a similar challenge with a Dutch and French site, let’s dive into solving this issue step by step.
Understanding the Current Implementation
Your current setup has two main problems:
- The French version’s links are prefixed with
fr/, which wasn’t your original intention. - The Dutch version is correctly prefixed with
nl/as per your requirement.
The goal is to remove the fr/ prefix from the French version while keeping the nl/ prefix for the Dutch one.
Step 1: Configuring the Base URLs
First, let’s ensure that the base URLs are set up correctly in the Magento admin panel:
# Go to Stores > Configuration > General > Web > Base URLs (Secure)
For your French store view:
- Set
Base URLtohttp://www.domain-name.com/ - Ensure
Use Secure URLis unchecked
For your Dutch store view:
- Set
Base URLtohttp://www.domain-name.com/nl/ - Ensure
Use Secure URLmatches the French setting
Hit Save Config.
Step 2: Setting Up the Scope ID
Next, we need to ensure that the correct scope IDs are assigned to each view:
# Go to Stores > Configuration > General > Design > Current Configuration Scope
For your French store view:
- Switch to the French store view using the top-right dropdown.
- Set
Current Configuration ScopetoDefault Config
For your Dutch store view:
- Switch to the Dutch store view using the top-right dropdown.
- Set
Current Configuration ScopetoOther - Then, set
Use Website DefaultsandUse Default Valuefor all fields
Hit Save Config.
Step 3: Clearing Cache
Finally, clear all Magento cache:
# Go to Stores > System Tools > Cache Management > Flush Cache Storage
After following these steps, your French links should now appear without the fr/ prefix while keeping the Dutch version with the nl/ prefix intact.
Conclusion and Additional Resources
Managing multiple store views in Magento requires a keen understanding of how the platform manages URLs. By carefully setting up base URLs and scope IDs, you can achieve the desired link structures for each view.
Remember that SEO is crucial when dealing with multilingual sites. Ensure that your redirects are properly configured to avoid duplicate content issues or 404 errors (check out our guide on SEO-friendly Magento redirects).
If you’re still facing challenges, feel free to consult the official Magento documentation or reach out to our expert development team for assistance.
Happy coding!