Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Two different account can login in the same time?

0 votes
253 views
asked Sep 23, 2015 in Q2A Core by Septian Nugroho

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
commented Sep 23, 2015 by Septian Nugroho
case study here http://tanyajawab.esy.es/ (try your own)

1 Answer

+2 votes
answered Sep 23, 2015 by steven2
selected Sep 26, 2015 by Septian Nugroho
 
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;
}
commented Sep 26, 2015 by Septian Nugroho
It's work well  now.... thanks :-)
...