Not a bug  automatically being logged-out when clicking on "Home"-button

erich37

Well-known member
at my XF-website when being logged-in as a user:

when the user is clicking onto the "Home"-button, the user is automatically being logged-out.

Same issue happening when clicking onto the logo-image.


I did not change anything at the settings, just default installed XF-software.
 
I am guessing this is a cookie scope issue. When you click the Home link does the domain portion of the URL change? For example, does one page have "www" and the other not? If the domain portion changes then the cookies are probably going out of scope.

You can change the Home link in your:

Admin CP -> Home -> Options -> Basic Board Information -> Home Page URL
 
Hi Jake,

yes, when the user is logged-in, the domain is without the "www".
But then when clicking onto the "Home"-Tab, the domain includes the "www".

I have changed this now in the ACP.

But I actually want to show the Home-Tab including the "www"
How to do this ?

Many thanks,
 
One solution is to simply login from both URLs.

Otherwise you will need to change your cookie domain in xenForo if you want it to work over your entire domain including all subdomains. The cookie domain needs to be:

.domain.com

...using your domain name, including the beginning dot.

However, xenForo doesn't let you change this in the Admin CP. I think there is a config.php setting for it but I don't know it. Kier or Mike will eventually get to this thread and one of them can probably tell you the setting to add.
 
as I removed the "www" at the settings within ACP, as you suggested, the strange thing now is:

when navigating the Forum, all URLs are having the "www" showing.
But the "Home"-Tab does not have the "www" within the URL.
 
The various links on the forum will use the same base URL as the current page. So if you start browsing the forum using "www" then all links will include that. You just need to be consistent with your links and bookmarks. Or login from both URLs. Or change the cookie domain.
 
If you ending up on a different sub-domain (domain.com and www.domain.com) being different, then with an out of the box config, this is expected. Generally speaking, you want to be consistent with this anyway. It's significantly better for search engines.

If you're an advanced user, you can configure the cookie settings via config.php:
Code:
$config['cookie'] = array(
	'prefix' => 'xf_',
	'path' => '/',
	'domain' => '.domain.com'
);
I wouldn't recommend doing that unless you know what you're doing though.
 
So what should be the format of my domain in the field within ACP ? Or should I leave it blank ?

"Home Page URL"

Admin CP -> Home -> Options -> Basic Board Information -> Home Page URL
 
ok, I have checked again:

when being logged in at the domain showing the "www", then entering the domain without the "www" into the browser-line, I am being logged-out automatically again.

So is this a server-issue or is this an issue with my ACP-settings ?

If it is a server-issue, what do I need to tell my hosting-provider to change ?

Many thanks,
 
It's just a matter of cookie scope.

Note that if you change the cookie domain in the config file then you need to logout/login again for the changes to take effect. Sometimes you also need to manually delete your browser cookies to get rid of the old cookie.
 
I have now contacted my host and they have made a "rewrite" within the ".htaccess" file, which means when someboody enters my URL without the "www", then he will be automatically forwarded to the URL including the "www".

I am just concerned whether this will be a negative impact for the search-engines ?

-------------------
RewriteEngine On > RewriteCond %{HTTP_HOST} !^www.mydomain.com [NC] > RewriteRule ^(.*) http://www.mydomain.com/$1 [R=301,L]

-------------------
 
I have now contacted my host and they have made a "rewrite" within the ".htaccess" file, which means when someboody enters my URL without the "www", then he will be automatically forwarded to the URL including the "www".

I am just concerned whether this will be a negative impact for the search-engines ?

-------------------
RewriteEngine On > RewriteCond %{HTTP_HOST} !^www.mydomain.com [NC] > RewriteRule ^(.*) http://www.mydomain.com/$1 [R=301,L]

-------------------
No, search engines are fine with that. :)
 
Many thanks for your help guys !

The hosting-company said this is an issue coming from the software I am using.......
 
Top Bottom