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
Problem with Session Id in urls
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Problem with Session Id in urls
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).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.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering