1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Get Logged Out When Switching Between 2 Boards on Same Domain

Discussion in 'Troubleshooting and Problems' started by Vilandra, Nov 7, 2010.

  1. Vilandra

    Vilandra Active Member

    I've set up tests for both my licenses in subforums of a single domain. But if I try to have both sites open at the same time, I get logged out of both almost immediately after logging in. I assume it's some sort of cookie thing, but I can't find where to set that on XF. Anyone able to point me in the right direction? Thanks!
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You will need to restrict the cookie scope of each forum by editing their respective library/config.php files. Add this code to each config file:

    Code:
    $config['cookie'] = array(
    	'prefix' => 'xf_',
    	'path' => '/path/',
    	'domain' => ''
    );
    
    For example, if these are the two forum URLs:

    http://www.yoursite.com/forum1/
    http://www.yoursite.com/forum2/

    Then you would use this code:

    Code:
    $config['cookie'] = array(
    	'prefix' => 'xf_',
    	'path' => '/forum1/',
    	'domain' => ''
    );
    
    Code:
    $config['cookie'] = array(
    	'prefix' => 'xf_',
    	'path' => '/forum2/',
    	'domain' => ''
    );
    
    That will restrict the forum cookies to their respective subdirectories so they don't step on each other.
     
    CRDeveloper, Luke F and Vilandra like this.
  3. Vilandra

    Vilandra Active Member

    Thanks once again Jake :)
     
  4. Dean

    Dean Well-Known Member

    Or use 2 different browsers like Fire fox & Chrome. I *think* that would also work.
     
  5. Mike

    Mike XenForo Developer Staff Member

    TBH, just changing the prefix of the cookie can be easier. The path works as well. :) (From a technical standpoint, I do find it easier to debug with different prefixes.)
     
  6. Floris

    Floris Guest

    That's not something you can ask your members, and it's not a solution either. But yeah, that will also work.

    Jake's solution will work, but all I run on mine is a cookie prefix, one_ two_ three_ four_ etc.
     

Share This Page