How to Avoid the ‘___from_store’ Query Parameter When Switching Store Views in Magento

By December 20, 2010Magento Code Snippets

This is a simple fix that makes a big difference. For some reason it is set to show up by default, however some websites that are sensitive to SEO or want to avoid this parameter so you do not get any weird values in Google Analytics or any other Analytics that you may be using, here is how to remove the ‘___from_store’ query string:

Find the languages.phtml. This file contains the line that produces the URLs to where we get redirected upon dropdown selection. On my specific installation it is in this file:

/app/design/frontend/default/template/page/switch/languages.phtml

Find line 41 and change it from:

echo $_lang->getCurrentUrl()

To this, basically pass ‘false’ parameter to this method:

echo $_lang->getCurrentUrl(false)

This will force the Store model in Magento to generate these URLs without the query parameter. Enjoy!

XYEQFBSXD2B7