I am working on a Intranet using Wordpress and setup in Apache (httpd-vhosts.conf) in order to access to the Intranet as intranet or intranet.domain.lcl
like this :
Listen 80
<VirtualHost 10.241.9.147:80>
DocumentRoot "C:/www/intranet"
ServerName intranet.domain.lcl
ServerAlias intranet
<Directory "C:/www/intranet">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 10.240.9 10.241.9
</Directory>
</VirtualHost>
In Wordpress settings i gave site Wordpress Address URL and Site Address as http://intranet.domain.lcl/wp
The problem that i have is that i use a PHP session to log users and i notice that if :
intranet
, he's not logged if he goes to intranet.domain.lcl
intranet.domain.lcl
, he's not logged if he goes to intranet
I test even without my script to log user via the php session and using the wordpress logi natural way but the problem is still the same.
Any clues ?
Thanks
This goes back to cross-domain cookies. If the browser is on the page a
, it will only save and send cookies for the domain a
. The server cannot set cookies for other domains nor will it get cookies for other domains from the browser. The same is true for domain b
, in reverse.
Two different domains are two different domains. Even if they harbour the same content, the browser doesn't know that. To the browser it's two different domains and they can't share the same login cookie.