Page 1 of 1

Keep Session Id Out of URL

Posted: Sun Mar 05, 2006 11:19 am
by idotcom
Hi

How do I keep my session id's out of urls when bots come to my site?

Every time a robot comes to spider my site, the are given urls with the PHPSESSIONID=VALE

I'm sick of it. It appends to every url. And all my SERPS have stupid session id's in them. :?


I'd greatly appreciate a solution to this. :D

Thank you

Posted: Sun Mar 05, 2006 11:58 am
by John Cartwright

Code: Select all

session.use_trans_sid = 0

Posted: Sun Mar 05, 2006 12:57 pm
by idotcom
Hi

Thanks for youre reply.

I tried:

Code: Select all

ini_set("url_rewriter.tags","");
ini_set("session.use_trans_sid", false);
And just a little bit ago msnbot came and still had session id in the url.

This is annoying... why would PHP allow this?

Any other ideas?


Thanks

Posted: Sun Mar 05, 2006 2:21 pm
by Benjamin
You can turn it off in an .htaccess file. I don't know the syntax offhand.

Posted: Sun Mar 05, 2006 3:28 pm
by eyespark
htaccess

php_flag session.use_trans_sid off

Posted: Sun Mar 05, 2006 4:32 pm
by idotcom
Thanks,

I tried that in htaccess too.

I emailed my host because everything I tried did not work.

I even tried this in htaccess: php_value session.use_trans_sid 0

Posted: Sun Mar 05, 2006 5:35 pm
by Gambler
I rcommend writing your own session handling functions (if that's an option). It much easier that dealing with the ones that are provided by PHP.

Example:
http://cvs.sourceforge.net/viewcvs.py/n ... iew=markup

Posted: Sun Mar 05, 2006 6:07 pm
by AKA Panama Jack
idotcom wrote:Hi

Thanks for youre reply.

I tried:

Code: Select all

ini_set("url_rewriter.tags","");
ini_set("session.use_trans_sid", false);
And just a little bit ago msnbot came and still had session id in the url.

This is annoying... why would PHP allow this?

Any other ideas?


Thanks
You have to make sure the ini_set("session.use_trans_sid", false); is before the session_start();. If it isn't then you will still get the session ids in the url.

Posted: Sun Mar 05, 2006 6:39 pm
by josh
"you need to enable session.use_only_cookies. In that case, cookies must be enabled unconditionally on the user side, or sessions will not work."
http://us3.php.net/session