How to Remove SID query from Magento URLs
We will apply the site redirects technique for this issue . While working on the SEO someone can place a wrong link to some forum or blog. We don’t want those links to lead to improper URL and we don’t want SIDs to appear to those visitors. Most important: We don’t want that search engines index the URLs with SIDs.
The solution is simple.
For magento1 you will have to go to root directory .htacess file and add the below code and in Magento2 you should write the code in the pub directory .htaccess file.
RewriteEngine on
If you want to have www part:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
If you don’t want to have www part:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]