What is a cookieless domain?
The concept and the setup for a cookieless domain are both fairly easy.
Excerpt from Google’s article – Minimize request overhead
Serving static resources from a cookieless domain reduces the total size of requests made for a page.
Static content, such as images, JS and CSS files, don’t need to be accompanied by cookies, as there is no user interaction with these resources. You can decrease request latency by serving static resources from a domain that doesn’t serve cookies. This technique is especially useful for pages referencing large volumes of rarely cached static content, such as frequently changing image thumbnails, or infrequently accessed image archives. We recommend this technique for any page that serves more than 5 static resources. (For pages that serve fewer resources than this, it’s not worth the cost of setting up an extra domain.)
For the sake of this tutorial, I will assume that this is a brand new domain that is solely for serving static content for another (or several other) domain(s).
To set up a cookieless domain using the Apache web server, edit or create a .htaccess file on the root of your cookieless domain. For example: your-domain.com/.htaccess
Adding the following Apache directives will get your cookieless domain up and running:
# Use Mod_deflate to compress static files
# Speed up caching
FileETag MTime Size
ExpiresDefault "access plus 366 days"
# Future Expires Headers
Header set Expires "Sat, 27 Dec 2014 23:59:59 GMT"
Once you have your cookieless domain set, simply add your static content (javascipt, css, ico files, text files, and image files) and have the links from your main site point to the correct path on your cookieless domain. You will see a speed improvement instantly.
I hope that this article gets you on your way to serving up your website much faster. I would love to hear your feedback so please leave a comment below. Thanks for stopping by.
Please note that I am still offering a service to Speed Up and Optimize your Website, so please take a look if you are interested.