Northern Flame Posted February 10, 2008 Share Posted February 10, 2008 I noticed that sometimes my links look something like this: http://www.mywebsite.com/script.php?PHPSESSID=[random string] when it should just be http://www.mywebsite.com/script.php how can I get rid of the PHPSESSID? Quote Link to comment https://forums.phpfreaks.com/topic/90324-not-important-but-curious-phpsessid/ Share on other sites More sharing options...
Northern Flame Posted February 10, 2008 Author Share Posted February 10, 2008 if anyones interested, i just found this code which will prevent your pages to be indexed twice by robots because of PHPSESSID <?php if (isset($_GET['PHPSESSID'])) { $requesturi = preg_replace('/?PHPSESSID=[^&]+/',"",$_SERVER['REQUEST_URI']); $requesturi = preg_replace('/&PHPSESSID=[^&]+/',"",$requesturi); header("HTTP/1.1 301 Moved Permanently"); header("Location: http://".$_SERVER['HTTP_HOST'].$requesturi); exit; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/90324-not-important-but-curious-phpsessid/#findComment-463141 Share on other sites More sharing options...
jacksonmj Posted February 10, 2008 Share Posted February 10, 2008 Try changing the settings of session.use_cookies or session.use_only_cookies. http://www.php.net/manual/en/ref.session.php#ini.session.use-cookies Quote Link to comment https://forums.phpfreaks.com/topic/90324-not-important-but-curious-phpsessid/#findComment-463162 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.