Shortening Magento URLs for Multiple Stores
When running an e-commerce website on Magento that supports multiple languages or stores, you might find that the default URL structure includes unnecessary parameters such as ?store=. While this parameter is useful for selecting the appropriate store scope within the backend, it can be removed to create cleaner, more SEO-friendly URLs.
Understanding Magento’s Language and Store Configuration
Before we dive into the code changes, let’s briefly review how Magento manages multiple languages and stores. By default, Magento uses a ?store= parameter in the URL to determine which store view to display. For example:
https://example.com/en/https://example.com/de/
In this case, en and de are the language codes for English and German respectively.
Removing the ?store= Parameter
To achieve URLs like https://example.com/de/ without the parameter, you’ll need to make a few modifications to your Magento configuration:
-
Update the base URL in the admin panel
- Log into the backend.
- Navigate to System > Configuration > General > Web.
- Under “Base URLs (SSL)”, set the “Unsecure Base URL” and “Secure Base URL” to
https://example.com/. - Click “Save Config”.
-
Update the language configuration
- In the admin panel, go to System > Manage Stores.
- Select your store view (e.g., English or German).
- Under the “General Information” tab, ensure that the “Url Key Suffix” field is empty for this store view.
-
Create a rewrite for the language URL
- In the admin panel, navigate to System > Configuration > Catalog > SEO.
- Set “Use Categories Path for Product URLs” and “Use Categories Path for Store URLs” to “Yes”.
- Click “Save Config”.
Conclusion
By following these steps, you should now have clean, language-specific URLs without the ?store= parameter. This not only improves the appearance of your URLs but also enhances their relevance for search engine optimization.
Remember, any changes made directly to Magento’s core files may be overwritten during updates. To ensure a more stable solution, consider using an extension like MageWorx SEO Suite or Amasty SEO Tools. These extensions provide advanced URL management features without risking data loss.
For more detailed tutorials on Magento development and best practices, feel free to explore the resources available at LaravelCompany.