submitted by: Guest

PHP: force cookies, disable php sessid in URL

This commands disables php from rewriting URLs to add a phpsessid, and forces the use of cookie sessions instead. Using cookies is largely thought of as the preferred way to use sessions - both more secure and better for SEO. This can be accomplished by setting the appropriate values in php.ini, or at runtime. This snippet shows a runtime example:


code snippet:
<?php
//These commands must be set BEFORE the session is started
ini_set('session.use_trans_sid'false);
ini_set('session.use_only_cookies'true);
ini_set('url_rewriter.tags''');

//start session...

?>