PHP : Remove trans SID from URL

Remove trans SID from URL for XHTML compliance


When search engine attempts to search your site, usually they won’t remember sent cookies so that php will add a unique PHPSESSID query pair to URIs within your site if cookies are not available and session.use_trans_sid is set. As a result of this, the links to your site at GOOGLE will always have a query string with the session attached to them, and they will look bad search engines that will crawl less of your site and they may even consider your site as mirroring itself when they  got different sessions appended. This looks to search engines as if different pages have exactly the same content, and they will lower your rank or even ban it.
You can find a good stuff here The best advisors  please Check it.

With the release of PHP version 4.2.0 you don’t need to configure PHP with --enable-trans-sid to have transparent session support, this means that a lot more hosts will have it.

Without this feature you can usually choose between sending cookies to the visitor and modifying the URLs, with cookies being the default setting. Cookies do no harm (most of the time) but appending a query string to all URLs is quite different.

If you have forms and have left the default settings for the rewritable tags PHP will also add a hidden input to forms on your site but does that in such a way that your code cannot validate as XHTML 1.0 Strict or XHTML 1.1.


But you want your site being at the top of the search engine. So to disable that feature, you should add the following line:




This is the RUNTIME modifiable string. This allows trans_sid to do its thing.


Of course you call them before calling session_start().