Php session in url

software development



I’ve read that sessions in the url are a big problem with search engines.

I don’t know why, but when a session starts the session id appears in the URL (and I’ve noticed that only on DreamHost).

I’ve managed to get rid of this using this line of code:

Now, the links on my page look ok (without the session id) but the search engine (Google) still indexes my pages including that annoying session id.

Is there another way to solve this problem?


I believe (but I am not certain) that you can solve this problem by changing the value of session.use_only_cookies in the php.ini file. If you haven’t already done it, you will need to carefully follow the procedure outlined in this wiki article to configure your own version of php.ini.

Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


When I first moved one of our sites (using sessions) over to dh I ran into this too. Its been a couple of years, so all the details are fuzzy, but I believe I fixed with htaccess. Might try researching “php_flag session.use_trans_sid off”.

I won’t guarantee that’s the solution because as I said, its been a while since I researched it, but I do have it in my htaccess & I think that’s why.