« Transfering huge cPanel account to new server | Main | Blue Frog Shut Down? »
May 10, 2006
PHP Session IDs removal
This article deals with removing php session ids (PHPSESSID) from the URLs of your php applications. Assuming you are using apache web server with ReWrite Mod enabled, you can add the following piece of code in your .htaccess file
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0
In order to redirect the URLs already indexed in search engines with the php session id ( PHPSESSID ) values add the following code in .htaccess file
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ^PHPSESSID=.*$
RewriteRule .* %{REQUEST_URI}? [R=301,L]
It may happen that editing .htaccess file may not be possible for you or that it produces Internal Server Error (Error 500).
In such cases you can add the following piece of code in your php application itself to get rid of phpsessid
ini_set('url_rewriter.tags','');
There may be many other methods to remove php session ids from the URLs but these two work best for me.
Posted by manish at May 10, 2006 11:49 AM