Joomla community powered logo

Site Slogan

Cookie free domains in Joomla - YSlow optimization

YSlow performance figures

When checking your Joomla site against the YSlow performance indicator without changing anything on your default configuration, you will get a recommendation for using cookie-free domains. Some more background information on this topic can be found at an article from Stoimen (Sections 1 & 2). Even if there is a lot of discussion on the usefulness of this topic, it's always nice to be able to improve your score with a minimum on effort.

The explanation on cookie settings in Joomla as explained below have made my YSlow performance figures go up with 1 to 2% - depending on the fact if all the cookies for images, css and js are created on your domain or not. The more images, css and js are served from your own domain, the more impact these changes will have on your score.

Joomla & cookie settings

Cookie Settings thumbnailSo we will set a cookie domain for the overall site. Please be careful when playing around with the Cookie Domain name, as this can make it impossible to log in to your site on the administrator panel (been there, done that myself and it took me a couple of hours to find out the exact cause - it turned out to be the cookie settings we will discuss in this article).

Inside your Joomla Administrator panel, you go to System > Global Configuration. On the first tab, you will find the "Cookie Settings" in the right bottom corner of your screen. Now the magic begins:

  • on the Cookie Domain, put ".example.com" (mind the dot at the start of your text) - please change the "example.com" into the name of your own domain
  • on the Cooke Path, put "/rootofyoursiteontheserver/cookie" - please change the "rootofyoursiteontheserver" into the correct path to the root directory of your www-site, e.g. httpdocs or http.www (this depends on your hosting company, the 2 examples or for 2 of the companies on which sites under my administration or hosted)

First aid in case of emergency

I warned you, you need to be very careful when entering the values in the text fields for your cookie settings. The good news is that , if you have done something wrong in your settings, normally it will not effect anything on your YSlow score or other scores AFAIK.
But ... things can go terribly wrong if you want to log in into the administrator part of your site if the settings are not correct. If you encounter this kind of situation: no panic. Even if you can't change the settings in your administrator interface of your site, there is a workaround using your FTP software and a simple editor.

  • Login via FTP to your site and download the file "configuration.php" (can be found in the root directory of your website)
  • Once this file is inside your editor, search for $cookie_domain and $cookie_path and remove all text between the quotes (but keep the quotes - look at the images just below for more details).

configuration php cookies set      configuration php cookies reset

NOTE! This site uses cookies.

If you do not change browser settings, you agree to it. Learn more

I understand

Cookies

To make this site work properly, we sometimes place small data files called cookies on your device. Most big websites do this too.

What are cookies?

A cookie is a small text file that a website saves on your computer or mobile device when you visit the site. It enables the website to remember your actions and preferences (such as login, language, font size and other display preferences) over a period of time, so you don’t have to keep re-entering them whenever you come back to the site or browse from one page to another.

How do we use cookies?

A number of our pages use cookies to remember:

Also, some videos embedded in our pages use a cookie to anonymously gather statistics on how you got there and what videos you visited.

Enabling these cookies is not strictly necessary for the website to work but it will provide you with a better browsing experience. You can delete or block these cookies, but if you do that some features of this site may not work as intended.

The cookie-related information is not used to identify you personally and the pattern data is fully under our control. These cookies are not used for any purpose other than those described here.

How to control cookies

You can control and/or delete cookies as you wish – for details, see aboutcookies.org. You can delete all cookies that are already on your computer and you can set most browsers to prevent them from being placed. If you do this, however, you may have to manually adjust some preferences every time you visit a site and some services and functionalities may not work.

You can find the full EU privacy guideline by clicking on this link