Authentication for multiple subdomain in CakePHP

Standard

Let say you have subdomain blog.website.com and help.website.com.

If you login to blog.website.com and when you access help.website.com you notice that you already authenticate althought the subdomain is different.

So how you want to differentiate the session after you login since the default setup of CakePHP will consider you on the same site ?

Edit your bootstrap.php in app / config and try to put this line .

ini_set(‘session.cookie_domain’, env(“HTTP_HOST”));

You can validate your cookie by installing Firebug in Firefox and installing an extension for firebug which is call ‘Firecookie‘.

Cheers ~!

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge

This site uses Akismet to reduce spam. Learn how your comment data is processed.