Create Cookie-free Domains for WordPress

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

Another server-side method to reduce server resources: 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", "http://static.domain.com");
    define("COOKIE_DOMAIN", "www.domain.com");

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

Leave a Reply