I use cookie based sessions, and they work for normal interaction with our site. However, when Googlebot comes crawling our PHP framework, Yii, needs to append ?PHPSESSID to each URL, which doesn't look that good in SERP.

Any ways to suppress this behavior?

PS. I tried to utilize ini_set('session.use_only_cookies', '1');, but it does not work.

PPS. To get an impression of the SERP, they look like this:

  • Looks like Google isn't having any issues at all indexing you. And that session ID won't affect your rankings. – John Conde Feb 16 '11 at 18:26
  • No, indexing is fine. It just, eeh, doesn't look so good ;) – miku Feb 16 '11 at 18:27

Have you tried using rel="canonical"? This link should help explain, http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=139394.


See Webmaster Tools: Updates to Search queries, Parameter handling and Messages at the Google Webmaster Central blog for instructions to suppress the PHPSESSID parameter in search results.

On the server-side, you should look into a way to prevent every hit from creating a session - session management is expensive server-side and it is generally undesirable to initiate sessions unless the content presented is dependent upon session data (as would hopefully not be the case with a search engine crawler).


Try adding CHttpSession::setUseTransparentSessionID(true) (api) somewhere in your Yii app, if it doesn't already exist.

I don't like visible session IDs either (triggers the flashbacks of PHP3 vs. broken IE cookies), so I always set it. I'm not 100% sure it'll fix the issue, but I haven't seen any session IDs sneak into search results for the few Yii apps I've built.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.