Page 1 of 1

Problem with Session Id in urls

Posted: Sat Nov 05, 2011 9:21 am
by mrleroux
Hi,

I hope someone can help.

I have a site that is using sessions (not just for when the user is logged in). All internal urls in the site are created via a central function in php. In that function I am appending the session id to the url only when the user has cookies blocked so that the session will still work (use_trans_sid is left disabled in php ini file).

The problem is that google is now indexing my site with the session id in the urls.

I've thought of manually setting the session id via php's function --> session_id($mySessionId) where $mySessionId is generated based on some predefined criteria such as environmental variables that are passed through a hashing function. In that case I'd no longer need to carry the session id in the url as I'd be able to determine what it should be, but what environmental variables will guarantee a unique id as the users ip address may change during the session?

I've also been wondering if .htaccess can be used to rewrite the url but that is not going to change the urls in the page/body content that will be crawled and indexed by google! Only the url in the address bar will be changed. Any ideas/suggestions will be appreciated.

Kind Regards,
Mikey

Re: Problem with Session Id in urls

Posted: Sat Nov 05, 2011 10:16 am
by social_experiment
mrleroux wrote:I've also been wondering if .htaccess can be used to rewrite the url but that is not going to change the urls in the page/body content that will be crawled and indexed by google! Only the url in the address bar will be changed. Any ideas/suggestions will be appreciated.
mod_rewrite will rewrite the url's but that will still have the session id in the url something like /sid/1234567 (i'm not knowledgeable on mod_rewrite so i could be wrong).