Create Cookie-free Domains for WordPress

Website speed is one of the first things someone notices when visiting your website. We have articles covering many ways to improve WordPress performance:

Another way to reduce the use of server resources and improve server performance is to use cookie-free domains. A cookieless subdomain separates website content that doesn’t change – e.g. media and CSS files – from sending unnecessary cookies to the server.

We recommend you create a cPanel backup before continuing. Then we’ll create a cookieless domain for WordPress.

Edit wp-config.php

  1. Log into cPanel.
  2. Create a subdomaine.g. cdn, images, or static – with your wp-content directory as the document root.

    Warning: You may need to use a different fully qualified domain name if your WordPress website has cookies valid across the entire second-level domain.

  3. Edit your wp-config.php file.
  4. Add the following to the bottom of the wp-config.php file:
    define("WP_CONTENT_URL", "https://static.domain.com");
    define("COOKIE_DOMAIN", "www.domain.com");

    You would replace domain.com with your domain name

After improving your WordPress performance, learn more about improving WordPress security.

Was this article helpful? Let us know!