Remove SID from Magento URLs
Magento will append a SID (session ID) to URLs if the url does not match what is set in admin. Thus, if you access the site without the WWW when the Magento config stipulates that WWW is used, you will see this SID.
Mod rewrite can be used to redirect all non-www traffic to the www version - however, you may find this does not work for you. If this is the case, you can over-ride the file which appends the SID to the link. This is a safe way of making changes to Magento, whereby future upgrades will not break this change.
To stop Magento from appending the SID to urls, build the following directory structure under your Magento install:
app/code/local/Mage/Core/Model/Session
Copy the following file into the Session directory created in the previous step:
app/code/core/Mage/Core/Model/Session/Abstract.php
Open the Abstract.php file and locate the following code:
public function getSessionIdForHost($urlHost)
{
if ($this->getSkipSessionIdFlag() === true) {
return '';
}
Change this code to:
public function getSessionIdForHost($urlHost)
{
return '';
if ($this->getSkipSessionIdFlag() === true) {
return '';
}
This change returns before any checking between www and non-www version of the URL, thus the SID does not get appended.
| There are 6 users online |
| 904,194 total unique visitors |
| 1,689,555 total pageviews |
| 334 visitors in the last 24 hours |
| 209 total visitors today |
| 379 pageviews today |
| This page has been visited 3,027 times |
| Most users online at once: 52 on 12/13/2009 |
