how to create a Cookie Free domain?

how to create a Cookie Free domain?

A Cookie Free domain is important to improve website performance. 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. For example, we will show you an easy way to use it to speed up your website without using a plugin. Even though the steps to achieve are easy to understand, you will need some basic PHP  or copy and paste skills.

Use a 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 to lead static files such as images, CSS and script files. For this article, we will focus only on the WordPress case.

How can we implement a Cookie-Free domain on WordPress?

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 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)

 

static 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  your domain name. Alternatively, if your Database prefix is different from wp_, make sure to replace wp_   wp_posts  with the right prefix.

If you followed this article properly, you should have succeeded in creating your cookie-Free domain on your WordPress website. This article is inspired by an article from key CDN. Feel free to check their website for other related content. If you need help in optimizing your website’s performance, you can reach out to us through our contact form.

Read also

Leave a Reply

Do you want a quality website, ecommerce or tools?

Please leave us a message, and an expert will contact you within the next few hours for a free 15 min consultation

Free Estimate