Search Engines and Session ID’s
Posted by Paul at 3:03 pm
A recent client was mystified as to why their website was featuring so poorly in the Google rankings for their specified keywords.It didn’t take long to discover the cause, session id’s…
Most search engines trawl the internet with cookies turned off, which prompts PHP to append a session ID to the URL when it enters a site that is using sessions (eg. example-website-name.com/index.php?PHPSESSID=ab123456789abc). The problem with this is that the page will be indexed by the search engine with the session id appended. Due to the unique value used each time for each session, this means that next time the search engine visits the page it will be looking for the previous ID value but will be allocated a new value as a new session is started. Thus the page will be reindexed with the new session value.This will happen very time, and has two main consequences:
1) The page ranking is ‘diluted’ between each indexed version of the same page,
2) When your pages are returned in a search engine the URL will look very messy and unfriendly.
There is much information on the internet about dealing with this problem, so I will just summarise the main points.
1) Stop it happening in the first place, by using cookies where possible rather than sessions (bear in mind that cookies have their own issues!).
2) prevent known search engine spiders from starting a session.
3) redirect search engine spiders to a version of the URL having removed the session id (use 301 permanent redirects).
4) Remove indexed pages with session ids appended by re-submitting the offending URL’s (perform step 3 first!).