OctoberCMS login with multiple websites in same browser

- 1 answer


I have been using OctoberCMS and I found this very useful indeed.

However, I have come across one strange thing which I want to share with you guys.

I have two different websites in my local server, lets say it website1 and website2 and the respective URLs are something like this http://localhost/website1 and http://localhost/website2.

And the Admin URLs are something like this http://localhost/website1_admin and http://localhost/website2_admin.

Additionally, both the websites have two different databases and those databases are in my local server only. (I am using XAMPP on Windows machine).

Now the interesting part is, If I login to website1 and then I login to website2, and go back to website1, then I am automatically getting logged out of it.

I just wonder, why is this happening? Or, Is this how OctoberCMS works? Or Do I need to make sure something which I have not done yet?

I just checked app.php file from both the websites and checked the key values of both the websites and I found those are different.

Any thoughts ?




This is happening because the cookie created is called october_session and it's set on the localhost domain. In other words, the same cookie and domain for both of your sites.

You can solve this in one of two ways:

1) You can set up virtual hosts in xampp so that your sites are something like http://website1.localhost and http://website2.localhost -- this way a separate october_session cookie will be set on each 'domain'.

2) You can go to config/session.php and change the line 'cookie' => 'october_session', so a different cookie name for each site.

source: stackoverflow.com