Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
681 views
in Q2A Core by

Firstly, I'm access http://domain.com (without the www) and login using user1 account.

After that, I'm access http://www.domain.com (with www), this process looks that I wasn't logged in. here I use user2 to login again and succeed.

in other times, i change back the addesses to http://domain.com again, and it's look that user1 is still logged in. I changed again to http://www.domain.com (with www) and it's look that user2 is still logged in.

http://domain.com for user1

http://www.domain.com for user2

How to fix it? I want  http://domain.com and http://www.domain.com will be logged using the same account (one account)... 

Q2A version: 1.7.1
by
case study here http://tanyajawab.esy.es/ (try your own)

1 Answer

+2 votes
by
selected by
 
Best answer
I think a better approach is force 'www' to redirect to without 'www'.  This would be good for search engines as well, as you don't want to serve two copies.  If you agree with that, then in index.php (in root) add:

if ( $_SERVER['HTTP_HOST'] == 'www.mydomain.com' ) {
            header( 'Location: ' . 'http://mydomain.com' . $_SERVER['REQUEST_URI'], 1, 301 );
            exit;
}
by
It's work well  now.... thanks :-)
...