ElkArte Community

Project Support => Support => Topic started by: Atlas on December 19, 2018, 09:07:10 am

Title: PHPSESSID in URLs
Post by: Atlas on December 19, 2018, 09:07:10 am
I'm looking for the right spot to include:
Code: [Select]
ini_set("session.use_cookies", 1);
ini_set("session.use_only_cookies", 1);
ini_set("session.use_trans_sid", 1);
...to remove PHPSESSID from URLs. It needs to be included at the beginning of every page and before:

Code: [Select]
session_start()


You can see the PHPSESSID in URLs in the Google Structured Data Validator (https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwww.elkarte.net%2Fcommunity%2Findex.php%3Fboard%3D17.0).
Title: Re: PHPSESSID in URLs
Post by: emanuele on December 19, 2018, 06:17:00 pm
Yes, guests get sessionid in the url during the 1st page load.
Google will catch up in a short while when canonical url is taken as reference.
It's not actually a php setting, but its injected in the code (and last time I remove some fancy stuff started happening, but can't remember the specifics because it was so long ago).
Well, you can try at the beginning of index.php, but as I said I'm not sure about the implications.
Title: Re: PHPSESSID in URLs
Post by: Atlas on December 20, 2018, 12:44:44 am
Well, I found/resolved the issue:

File: /sources/Session.php

find:
@ini_set('session.use_only_cookies', false);

replace:
Code: [Select]
@ini_set('session.use_only_cookies', true);

I'll monitor for issues. So far so good.