In magento, I am using two store views one is for arabic and another one is english language. When I am switching the store to english this string is appended in url (___store=english) for english store view.like wise for arabic. Now I want to remove the ?___store=english for english and ?___store=arabic for arabic in URL.
7 Answers
If using the link widget, use the following process.
Copy app/code/core/Mage/Catalog/Block/Widget/Link.php
to app/code/local/Mage/Catalog/Block/Widget/Link.php
Search for (line 91 in Magento 1.7.x / line 100 in Magento 1.9.x)
$this->_href = $this->_href . $symbol . "___store=" . $store->getCode();
And modify to
$this->_href = $this->_href;
Upload and save your changes and you'll now not have your widget (dynamically) inserted links getting appended with ?___store=default.
Credit: DesignHaven

- 3,919
- 5
- 38
- 62
To remove this format: ?___store=english for english and ?___store=arabic
In the design file find the languages.phtml
/app/design/frontend/default/template/page/switch/languages.phtml
In the line 41
echo $_lang->getCurrentUrl()
Add 'false' as parameter
echo $_lang->getCurrentUrl(false)
Actual Url:
http:example.com?___store=english for english and ?___store=arabic
After added the false parameter in $_lang->getCurrentUrl(false) method. Url will be generated like the below
http:example.com?___store=english
Then to remove the '___store=english' parameter you need to add a pre dispatch event in the controller action: Add this code in your local module config.xml
<controller_action_predispatch>
<observers>
<controller_action_before>
<class>marketplace/observer</class>
<method>setToControllerActionPreDispatch</method>
</controller_action_before>
</observers>
</controller_action_predispatch>
Add this method in your local observer
public function setToControllerActionPreDispatch($observer)
{
$pathInfo = Mage::helper('core/url')->getCurrentUrl();
if(strpos($pathInfo, "___store") != ''){
$pathInfo = str_replace(array('?___store=arabic', '?___store=default'), '' , $pathInfo);
Mage::app()->getResponse()->setRedirect($pathInfo);
}
}

- 86
- 1
- 1
- 9
-
are you telling we need to create local module for adding `config.xml & observer` code ? or can we add those codes anywhere in any module ? – fresher May 19 '16 at 05:57
In admin got to System > Configuration (from the top menu), then go to 'Web' form the left menu.
The first option is 'Add Store Code to Urls', set this to no.

- 1,548
- 1
- 9
- 15
-
1Thank for your comment.But If we do like the above, the url like this format ?___store=arabic&___from_store=default. As I need to remove the store parameter. – sakthivel Dec 05 '14 at 05:43
After looking at this and experimenting in the admin, my thought is to consider multiple Magento 'websites' instead of stores. It seems even if you exclude the query parameter, Magento wants to append the store name as the first component of the URI. In short, I'm not sure how good an idea it is to try and actually remove the store component from the URL when using multiple 'stores'.

- 66,362
- 10
- 68
- 89
To remove this format: ?___store=english for english
Step 1 : Go to system->Configuration. Then go to web tab. You can see there is an option ' "Add Store Code to Urls" set that option to "Yes"
Step 2 : /app/design/frontend/base/default/template/page/switch/languages.phtml find this below code :
echo $_lang->getCurrentUrl()
Add 'false' as parameter
echo $_lang->getCurrentUrl(false)
Step 3 : Copy app/code/core/Mage/Catalog/Block/Widget/Link.php to app/code/local/Mage/Catalog/Block/Widget/Link.php
Search this line :
$this->_href = $this->_href . $symbol . "___store=" . $store->getCode();
And modify to :
$this->_href = $this->_href;
Step 4 : Go to Admin panel locate navigation system->Index Management >> Reindex Data

- 1,449
- 15
- 24
I know the question is old, but if anybody needs this functionality yet and you do not want to change any files I forked module on Github and added some improvements.
You can also use composer to install it.

- 3,326
- 2
- 25
- 36
If, like us, you already have these URLs indexed by Google, you should exclude them in URL parameters, ensure you have a canonical URL tag and then you could also intercept the request in something like index.php and 301 it to a page without the unwanted params:
$url = parse_url($_SERVER['REQUEST_URI']);
if (!empty($url['query'])) {
//$params = arrary();
$checkingfor = array('___store', '___from_store');
parse_str($url['query'], $params);
if (count(array_intersect_key(array_flip($checkingfor), $params)) > 0) {
$vars = array_diff_key($params, array_flip($checkingfor));
$finalUrl = http_build_url(
'',
array(
"scheme" => $_SERVER['REQUEST_SCHEME'],
"host" => $_SERVER['SERVER_NAME'],
"path" => $url['path'],
"query" => http_build_query($vars)
)
);
header('Location: ' . $finalUrl, true, 301);
exit();
}
}
If you don't have PECL installed, use this alternative to http_build_url().
Also posted here.

- 368
- 2
- 4
- 13