PDA

View Full Version : Make cookies work properly with multiple domains


James Cridland
12-07-2001, 10:00 PM
If your site is available at, for example, http://www.vbulletin.org as well as http://vbulletin.org (one with the www and one without) then your forums will work perfectly under either domain name.

However, if you log on at http://www.vbulletin.org, you won't be logged on at http://vbulletin.org as well, since the cookies held on your machine are different for each domain name.

Further, if you own www.vbulletin.info as well (not the case here), these other domain names will cause problems with cookies as mentioned earlier, and also confuse automatic traffic measurement tools like Alexa and Hitwise.

If you want to fix it, then you'll find a hackette enclosed. (It's one line of code). It will translate any page request on http://vbulletin.org to the same page on http://www.vbulletin.org/

See it working here on VBulletin (installed after I suggested it (https://vborg.vbsupport.ru/showthread.php?threadid=33037) and it was modified slightly by Firefly to make it a bit easier).

Also see the same code working, albeit not under VBulletin, by going to http://www.virginradio.co.uk (the 'real' address) or http://virginradio.co.uk/ or http://www.virgin-radio.com/ or... etc

Matt
12-08-2001, 05:40 PM
OMG! I just installed and am about to test! I hope to God it works as its EXACTLY what I need!!! :) Thankyou!

Modshack
12-08-2001, 07:18 PM
Installed and working fine for me, a life saver and very much appreciated.

HM

Tommy Boy
12-08-2001, 10:53 PM
Hmmm... I don't want to sound rude, but I'm not sure why it is needed, except for aesthetic reasons. If you want your cookies to work with all your sub-domains and directories, just set the "Cookie Domain" field to ".vbulletin.com" (change to your domain, NOTE THE TWO DOTS!), as explained in the Admin options page. Also, set the "Path to save cookies" field to "/". It is working for me, and I'm using the same cookies in different sub-domains and directories. :)

amykhar
12-08-2001, 11:44 PM
Tommy Boy,
Some users just aren't that computer literate, and they follow links on the board pasted by others, and then freak out when told they can't read because they aren't a member. They never look and see that they just need to log in to the "other" domain, they just fire off an email "Why did you ban me?! I can't access the site!". Users are generally paranoid people. This hack just might save the sanity of some poor webmaster somewhere. :D

Amy

bira
12-09-2001, 02:55 AM
Amy, Tommy Boy is right though.

If your website is accessible both as http://vbulletin.com and http://www.vbulletin.com, then set the cookie domain to .vbulletin.com in the Admin Control Panel Options page.

This has NOTHING with users being computer illiterate, it's got to do with Admins not doing it right. It doens't make sense to me that you as an admin would prefer to install a hack rather than set the option that already exists in vB correctly.

Wayne Luke
12-09-2001, 04:26 AM
It is correct but if you have two disimilar domain names then it will be a great help. For example we not only use www.sitepointforums.com and sitepointforums.com but users can also access it through www.sitepointforum.com and sitepointforum.com (note the singular form of forum). You can't handle this using the cookie options in vBulletin.

I will be using this, Thanks...

Tommy Boy
12-09-2001, 06:01 AM
This is true, if you have different DOMAIN names, then installing this hack is the only way to do it. Note however, that the user will be just redirected to the domain name on which he is already logged in...

James Cridland
12-09-2001, 10:35 AM
It's more useful for people with (like me) mediauk.com, mediauk.co.uk, mediauk.org and mediauk.info. No amount of crafty cookie programming is going to sort that out, plus third-party traffic checkers will treat these domains as separate sites, therefore making you look worse than you actually are.

Lesane
12-09-2001, 11:47 AM
Thanks James, i was waitin' for this hack.. Worked very good. I use www.domain.com & www.otherdomain.com/board.

Modshack
12-09-2001, 11:58 AM
I get on average 30 mails a day hurling abuse for banning them (Ok MOST did get banned anyhow as we are very strict) but any small help to prevent this is welcomed as has been said above not every user is computer literate and often needs as much help as they can get.

Once again I thank you for this hack and it HAS already proven invaluble on my forums.

Yours

HM

Syphin
12-09-2001, 01:25 PM
Thnx for this.. ^^ Usin it on 5 of domains now.. lol :p


-Syphin

Lesane
12-10-2001, 07:27 AM
Since i installed this lil hack some members of my board saying that they are loggedin as a other user. Some members are loggedin as a moderator and see the private forums. :confused:

I dont know how this could be happen and i'm not sure if this hack is the problem. I deleted this hack now and hope that the problem is solved.

James Cridland
12-10-2001, 07:34 AM
Don't understand how that can happen at all. All we're doing is redirecting someone.

Tim Wheatley
06-04-2003, 12:10 PM
Thanks for this, works great with 2.3.0

Tim Wheatley
06-04-2003, 07:28 PM
Uninstalled, I'm getting 404 errors on other people's sites when I go to enter a forum, other pages are loading that I've never visited etc etc... Very weird.