Magento – Remove session Id from URL

apimagento-1.9sessionurl

My website has only one store,some times when hitting URL its shows SID with URL, I want to remove session Id from URL.I know there is admin setting to display in frontend. My store has some API based on front end controller and when I am setting show SID on frontend to NO ,my mobile APIs are not working properly because they are using session Id , is there a way where we can use SID but hide from URLs?

Best Answer

You can remove the SID in two ways:

  1. Go to your Magento admin panel > System > Configuration > Web. Under Session Validation Settings, set "No" against label 'Use SID on the Frontend". If this doesn’t work, then move to second option below.

  2. Edit the file at app/code/core/Mage/Core/Model/App.php (somewhere around line 222), protected $_useSessionInUrl = true; Change that value to "false". That should now prevent session IDs appearing in URL.

Hope this will help you!