Welcome Guest, Not a member yet? Register   Sign In
sessions lost if 'www' removed from URL
#1

[eluser]smick[/eluser]
Hello,

I just discovered that if I change the url of my website from http://www.mysite.com to http://mysite.com that none of my session data is retained?

How can I fix this error?

Thanks for any info.
#2

[eluser]Dam1an[/eluser]
This is because www.site.com and site.com are considered to be 2 differant websites
To get around this, you can use .htaccess to always force the same version (always with or without the www)
I can't remember what it is off the top of my head, so you'l have the search for it
#3

[eluser]eoinmcg[/eluser]
Adding this to the end of your .htaccess should do the job

Code:
RewriteCond %{HTTP_HOST} !^www.yourdomain\.com [NC]
    RewriteRule ^(.*) http://www.yourdomain.com/$1 [R=301,L]

Of course, if you have
Code:
[L]
elsewhere in the file, best to remove it as it means last line and nothing will be processed after it.




Theme © iAndrew 2016 - Forum software by © MyBB