how to create a Cookie Free domain

how to create a Cookie Free domain

Sunday July 7, 2019 Gilblas Ngunte Possi
how to create a Cookie Free domain

07

Jul

07

Jul
A Cookie Free domain is important to improve website performance. In order to improve website performance, there is a recommendation from GTmetrix about cookie Free Domain. What is it?  And how can we implement it on WordPress? Those questions will be the purpose of this article. We will, for example, show you an easy way to use it to speed up your website without using a plugin. Even though steps to achieve that are easy to understand, you will need some basic PHP  or copy and paste skills.

GTmetrix COOKIE-FREE DOMAIN

What is a Cookie Free Domain?

One of the best answers to the question is the one provided in serverfault.com. That is: It is "A domain that serves no cookies. The idea here is that you use a cookie-free domain to serve images, CSS files, scripts  so that your users don't waste time and bandwidth transmitting cookies for them." In other words, that will improve your website performance by reducing the time that users would have been wasted transmitting cookies of static content. We generally implement a cookie-free domain by implementing a sub-domain that we use to lead static files such as images, CSS and scripts files. For this article, we will focus only on the WordPress case.

how can we implement Cookie-Free domain on WordPress

In order to implement it on your WordPress website, there are three steps that you need to follow:

1- Create a sub-domain for your website

If your domain name is domain.com, for example, you can create a subdomain called static.domain.com that will serve as your cookie-Free. The steps to achieve that may vary depending on your server. For the purpose of this article, we are going to base our example on the CPANEL. In the dashboard of your Cpanel, follow these steps: subdomain
  • Click on the icon subdomains
  • Enter the subdomain name. For example, static; if you want static.domain.com as your subdomain. Moreover, you should make sure that your subdomain point to your WordPress Content path (wp-content)
sub domain

Recommended Reading: How to increase traffic with Search Engine Optimization (SEO)?

2- Edit the file wp-config.php

Open the configuration file of WordPress, located under the installation directory and paste the following code :

3.  Update your SQL database with the following query

In the query above, you need to replace yourwebsite.com  by your own domain name. Alternatively, if your Database prefix is different from wp_, make sure to replace wp_ in  wp_posts  by the right prefix. If you followed this article properly, you should have succeeded in creating your cookie-Free domain on your WordPress's website. This article is inspired by an article from key CDN. Feel free to check their website for other related content. If be any chance, you need help in optimizing your website's performance you can reach out to us through our contact form.