News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Stoyan Stefanov's Blog:
www vs no-www and cookies
May 14, 2008 @ 11:18:39

Stoyan Stefanov has come up against one of the frustrations of web development involving cookies - problems caused by the switch from a "www." in the host to none. He's come up with a test to show you how cookies are set and where you can access them from.

One of the implications of following the rule is related to the whole www vs no-www question. Basically you should always use www if you're planning to use any other sub-domains and you want them cookie-free. This is because you have no way to set a cookie only to the top-level domain.

His code sets cookies for the ".phpied.com", "phpied.com" and "www.phpied.com" domains. Since the domains without the "www" offer a bit broader range of possible matches, he recommends that if you're ever going to use any kind of subdomain, you'll want to use the more broad cookie to cover it.

0 comments voice your opinion now!
cookie hostname test board coverage


blog comments powered by Disqus

Similar Posts

Matthew Weir O'Phinney's Blog: ZendCon: Best Practices Session

Community News: PHP 5.4.0beta1 Released for Testing

Travis Swicegood's Blog: Quick review of Zend_Log

PHPMaster.com: Taking Advantage of PHP's Built-in Server

David Goodwin's Blog: Release - Pale Purple's Trac Project Planning Board


Community Events

Don't see your event here?
Let us know!


introduction unittest api extension library laravel interview version series language laravel5 opinion community threedevsandamaybe voicesoftheelephpant symfony podcast release security framework

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework