Wordpress: Remove PHP Session IDs

If you use Wordpress and the excellent aLinks plugin, you may notice that each link it inserts in a post has a PHPSESSID parameter tagged on the end – a PHP Session ID – which then gets indexed within SERPS. Now I’m not sure what impact this has on search engine positions to be honest, but it looks messy.

So the way to remove PHP Session ID’s is as follows. If you go to the aLinks plugin directory and grab the aLinks.php script, you will see session_start() command a few lines down from the top, contained in this instance within an if() loop. Simply replace:

if (!isset($_SESSION)) {
 session_start();
}

…with…

if (!isset($_SESSION)) {
 ini_set( ’session.use_cookies’, ( int )1 );
 ini_set( ’session.use_trans_sid’, ( int )1 );
 session_start();
}

 

…and that should remove the Session IDs from any aLinks links.

Comments are closed.