perezf Posted December 8, 2008 Share Posted December 8, 2008 why does my session change if my domain has www or not? How can i keep the same session in php changing from www to no www and vice versa? Quote Link to comment https://forums.phpfreaks.com/topic/136080-php-sessions/ Share on other sites More sharing options...
gevans Posted December 8, 2008 Share Posted December 8, 2008 Why don't you use a .htaccess file to force the www. to display!! That would solve your problem without having to address it!! Quote Link to comment https://forums.phpfreaks.com/topic/136080-php-sessions/#findComment-709540 Share on other sites More sharing options...
premiso Posted December 8, 2008 Share Posted December 8, 2008 I always force my site to use www. using .htaccess. That way sessions and cookies do not change/stop working. The reason it changes is cause cookies are domain specific so, www.domain.com is different then domain.com. Quote Link to comment https://forums.phpfreaks.com/topic/136080-php-sessions/#findComment-709541 Share on other sites More sharing options...
PFMaBiSmAd Posted December 8, 2008 Share Posted December 8, 2008 http://www.phpfreaks.com/forums/index.php/topic,228765.msg1057339.html#msg1057339 Quote Link to comment https://forums.phpfreaks.com/topic/136080-php-sessions/#findComment-709543 Share on other sites More sharing options...
perezf Posted December 8, 2008 Author Share Posted December 8, 2008 So what would be the htaccess code for the forcing of www. Quote Link to comment https://forums.phpfreaks.com/topic/136080-php-sessions/#findComment-709739 Share on other sites More sharing options...
will35010 Posted December 8, 2008 Share Posted December 8, 2008 So what would be the htaccess code for the forcing of www. RewriteEngine on RewriteCond %{HTTP_HOST} !^www.your_domain.com$ RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301] Quote Link to comment https://forums.phpfreaks.com/topic/136080-php-sessions/#findComment-709744 Share on other sites More sharing options...
premiso Posted December 8, 2008 Share Posted December 8, 2008 RewriteEngine on RewriteCond %{HTTP_HOST} !^www.your_domain.com$ RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301] http://www.google.com/search?hl=en&q=htacces+force+www&btnG=Google+Search First result. Quote Link to comment https://forums.phpfreaks.com/topic/136080-php-sessions/#findComment-709749 Share on other sites More sharing options...
will35010 Posted December 8, 2008 Share Posted December 8, 2008 RewriteEngine on RewriteCond %{HTTP_HOST} !^www.your_domain.com$ RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301] http://www.google.com/search?hl=en&q=htacces+force+www&btnG=Google+Search First result. yup, that's how I found it. Sorry about forgetting the code boxes. Quote Link to comment https://forums.phpfreaks.com/topic/136080-php-sessions/#findComment-709763 Share on other sites More sharing options...
perezf Posted December 8, 2008 Author Share Posted December 8, 2008 Thanks everyone for the help, Do you guys also know how to do 301 redirects in Htaccess for instance im trying to redirect all my old pages to the new pages so if someone was to goto domainname.com/oldpage.html it would redirect them to domainname.com/newpage.html Quote Link to comment https://forums.phpfreaks.com/topic/136080-php-sessions/#findComment-709834 Share on other sites More sharing options...
premiso Posted December 8, 2008 Share Posted December 8, 2008 Thanks everyone for the help, Do you guys also know how to do 301 redirects in Htaccess for instance im trying to redirect all my old pages to the new pages so if someone was to goto domainname.com/oldpage.html it would redirect them to domainname.com/newpage.html Google does wonders http://www.google.com/search?hl=en&q=301+redirect+htaccess&btnG=Google+Search Quote Link to comment https://forums.phpfreaks.com/topic/136080-php-sessions/#findComment-709840 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.