smerny Posted May 16, 2010 Share Posted May 16, 2010 Hello, does anyone know how I can make it so that sessions and cookies will work regardless of whether the 'www' is in the URL or not? right now it treats them as 2 different sites.... if i log in with the www showing and then access it without... there is no session or cookie if i log in without the www showing and then access it with... there is no session or cookie Quote Link to comment https://forums.phpfreaks.com/topic/201972-sessions-and-cookies-with-or-without-the-www/ Share on other sites More sharing options...
Alex Posted May 16, 2010 Share Posted May 16, 2010 It's sloppy to allow access to your website both with and without www. You should be forcing one or the other. This article should help you: http://www.jonlee.ca/forcing-www-in-domain-name/ Quote Link to comment https://forums.phpfreaks.com/topic/201972-sessions-and-cookies-with-or-without-the-www/#findComment-1059228 Share on other sites More sharing options...
smerny Posted May 16, 2010 Author Share Posted May 16, 2010 from the link: here is the code to add to your .htaccess file to force www, but make sure mod_rewrite apache module is turned on: where do i find the .htaccess file and where do i make sure that mod_rewrite apache module is on? Quote Link to comment https://forums.phpfreaks.com/topic/201972-sessions-and-cookies-with-or-without-the-www/#findComment-1059232 Share on other sites More sharing options...
smerny Posted May 16, 2010 Author Share Posted May 16, 2010 nevermind about the htaccess, it was 'hidden' but about the mod_rewrite apache module? edit: nevermind that either, it is apparently on since it is working. thanks Quote Link to comment https://forums.phpfreaks.com/topic/201972-sessions-and-cookies-with-or-without-the-www/#findComment-1059249 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.