Get Appointment

We have received your message and will contact you soon.

Thank you for choosing prositeweb, your web development agency in Montreal. Please call us at +1 (514) 548-2165 if you need immediate support.

How to create a Cookie Free domain on a WordPress website?

In this article, we explain how to create a cookie free domain: –

  • What is a cookieless domain?
  • What is a domain-less cookie?
  • How can we implement a cookieless domain on WordPress?

If you want any further information on the topic or want to create your own website, contact us today!


A cookie free domain is essential for improving website performance. Indeed, To enhance the website’s performance, there is a recommendation from GTmetrix regarding the cookieless domain. What is that? How to implement it on WordPress? These questions will be the focus of this article. For example, we are going to show you an easy way to use it to speed up your website without using a plugin. Even though the steps are easy to understand, you will need some basic PHP or copy-paste skills.

Utilisez un domaine sans cookie

What is a cookieless domain?

Before discussing a cookieless domain, it is important to define a cookie.

What is a cookie?

A cookie in web jargon is a piece of information that websites or applications save in your web browser. This is generally intended to facilitate the management of your information or preferences. For example, if you visit a car sales website. The website you visited may put data in your browser to subsequently make suggestions to you about your preferences. This is quite common in the web world, and several solutions would work with quite a limitation if there were no cookies.

Cookies usually have a maximum size of 4 KB per domain name. It is important to note that as a user, you can block or limit cookies on your web browser.

As cookies accumulate in your browser, it affects how long you can take to navigate a website. This is why you will notice that a website takes longer to display information after a while compared to your first visit.

What is a domain-less cookie?

The information about your photos or video is generally static (changes little). Therefore, having a domain name that does not retain cookies when serving images and other static files can help improve performance. A cookieless domain name is a domain you set up for your photos, videos, and other code like CSS and JS.

How can we implement a cookieless domain on WordPress?

To implement it on your WordPress website, you need to follow three steps:

  1. Create a subdomain for your website
  2. Make some adjustments in your wp-config.php code
  3. Update database

1- Create a subdomain for your website

If your domain name is, for example, you can create a subdomain called that will serve as your cookieless domain.

The steps to follow may vary depending on your web server.

Before creating a subdomain, you must make sure that your domain offers this possibility. Indeed, in your DNS record (the server where you manage your domain name settings), you must add a CNAME line similar to what you see below. It would therefore be important to make sure that your domain name is active after its creation before making the configurations.


For this article, we will base our example on the cPanel. In your cPanel dashboard, follow these steps:


  • Click on the subdomains icon
  • Enter the subdomain name. For example, static; if you want as subdomain. Additionally, you need to make sure your subdomain points to your WordPress content path (wp-content).

domaine statique

2- Modify the wp-config.php file

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

/* Edit wp-config.php and add this code. replace by your own code */
define("WP_CONTENT_URL", ""); 
define("COOKIE_DOMAIN", "");

3. Update your SQL database with the following query

To update the database, you need to check your tables prefix in your wp-config.php file. Usually the prefix is ​​wp_. However, it is possible to change when creating a website. Once you find the prefix. You will need to connect to your database server to make the request.

This step involves changing the links to the images to point them to the new server. Below is an example request.

UPDATE wp_posts SET post_content = REPLACE(post_content,'','');

In the query above, you need to replace code > your domain name. Otherwise, if your database prefix differs from wp_, replace wp_posts code> with the correct prefix.

Create a cookieless domain for a solution other than WordPress

The creation process could be similar to the case of WordPress. You would simply have to create the subdomain and then replace the links of the photos and other static information to point them to the new domain.

If you follow these steps, you will notice the performance improvement in your analysis report.

If you followed this article correctly, you should have successfully created your cookieless domain on your WordPress site. Feel free to check out their website for different related content. If you need help optimizing the performance of your website, you can contact us through our contact form.

Share :


Agence de création de site web à Montréal

How to protect comment forms from spam (Integrated Features and reCAPTCHA)
18 September 2022
5 options to reduce brute force attacks on your WordPress website
27 April 2022

Do you have a project in mind? Contact our web agency for a free evaluation.

Contact us if you are looking for a Montreal-based web agency capable of supporting you in Backend and Frontend development.