{"id":18117,"date":"2021-09-07T07:32:00","date_gmt":"2021-09-07T07:32:00","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=18117"},"modified":"2026-03-09T19:19:07","modified_gmt":"2026-03-09T19:19:07","slug":"cookieless-domain-warning","status":"publish","type":"post","link":"\/ng\/tutorials\/cookieless-domain-warning","title":{"rendered":"How to use cookie-free domains: what they are and why you need them"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Website speed has a great impact on user experience, traffic, and SEO. Several tools, such as GTmetrix, allow you to check your website speed, giving warnings and recommendations according to its weak spots.<\/p><p>If your site is experiencing slow load times or GTmetrix displays a cookie-free error when analyzing your web performance, you may want to start using a cookie-free domain.<\/p><p>This article will provide the steps necessary to create and use a cookie-free domain in your WordPress website.<\/p><figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Build-WordPress-Website-in-9%20Steps.pdf\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/public\" alt=\"\" class=\"wp-image-69276\" style=\"width:840px;height:auto\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><p>\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-are-http-cookies\">What Are HTTP Cookies?<\/h2><p>HTTP cookies are text files containing data components a website sends to the users&rsquo; web browser, such as login authentication and language preferences, to improve user experience.<\/p><p>When you access a site with cookies for the first time, the site sends a request to your browser to store its cookies. The browser then stores this data, which helps the site provide a personalized browsing and online advertising experience based on previous visits.<\/p><p>However, the information it will collect depends on the website&rsquo;s needs. For example, an <a href=\"\/ng\/tutorials\/how-to-start-an-online-business\">eCommerce website<\/a> usually uses cookies to track your purchase history and shopping cart items.<\/p><p>The next time you visit it, the cookies stored will help the site recommend products or display ads according to your previous activity.<\/p><h2 class=\"wp-block-heading\" id=\"h-what-is-a-cookie-free-domain\">What Is a Cookie-Free Domain?<\/h2><p>When an HTTP request is made, the browser sends data and response headers to the site&rsquo;s server. Some of these might include <strong>Set-Cookie<\/strong> headers, which tell the browser to set certain cookies.<\/p><p>Since static content like images, <a href=\"\/ng\/tutorials\/what-is-javascript\">JavaScript<\/a>, and CSS files rarely change, sending those cookies will do nothing but clog the web server with unnecessary network traffic &#8210; causing your site to slow down.<\/p><p>A cookie-free domain is a domain that doesn&rsquo;t send the browser a request to store the site&rsquo;s cookies. Using this domain type will reduce the number of requests sent to the server since it will not send cookies for content that doesn&rsquo;t need them.<\/p><p>Consequently, it will improve your website&rsquo;s performance, eliminating unnecessary traffic.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-use-a-cookie-free-domain-in-wordpress\">How to Use a Cookie-Free Domain in WordPress<\/h2><p>There are two methods you can use to set a cookie-free domain. The first one requires creating a separate domain to deliver the static content. That&rsquo;s because if you use a domain like <strong>yourwebsite.com<\/strong>, the cookies will be set in all your subdomains as well.<\/p><p>However, if you use a regular domain like <strong>www.yourwebsite.com<\/strong>, you only need to create a cookie-free subdomain. To use a cookie-free domain on your <a href=\"\/ng\/tutorials\/what-is-wordpress\">WordPress website<\/a>, simply follow these steps:<\/p><ol class=\"wp-block-list\">\n<li>If you use a <a href=\"\/ng\/web-hosting\">Hostinger hosting plan<\/a>, go to the <strong>hPanel<\/strong> and select <strong>Subdomains<\/strong>. Create a new subdomain &#8210; static.yourwebsite.com, for example.<\/li>\n\n\n\n<li>Point the subdomain to the WordPress <strong>wp-content<\/strong> directory by updating the document&rsquo;s <strong>root field<\/strong>. You can do so when creating the subdomain via the <strong>Subdomains<\/strong> subdirectory on your hPanel. Select <strong>Custom folder for subdomain<\/strong> and add <strong>wp-content<\/strong> as the folder name, like on the screenshot below.<\/li>\n<\/ol><figure class=\"wp-block-image size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/11\/subdomains-directory.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"415\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/11\/subdomains-directory.png\/public\" alt=\"Creating a new subdomain on hPanel\" class=\"wp-image-38933\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/11\/subdomains-directory.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/11\/subdomains-directory.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/11\/subdomains-directory.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/11\/subdomains-directory.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/11\/subdomains-directory.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/11\/subdomains-directory.png\/w=2048,fit=scale-down 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><ol class=\"wp-block-list\" start=\"3\">\n<li>Navigate to the <strong>File Manager<\/strong> and add the following code to the <strong>wp-config.php<\/strong> file. Don&rsquo;t forget to replace the links to reflect your webpage&rsquo;s URLs.<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define(\"WP_CONTENT_URL\", \"http:\/\/static.yourwebsite.com\");\ndefine(\"COOKIE_DOMAIN\", \"www.yourwebsite.com\");<\/pre><p>Ensure these lines are placed above the <strong>\/* That&rsquo;s all, stop editing! Happy publishing. *\/<\/strong> line. Placing them below this line may result in the settings not being applied correctly.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/01\/file-manager-wp-config-php-codes-highlighted.png\"><img loading=\"lazy\" decoding=\"async\" width=\"880\" height=\"229\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/01\/file-manager-wp-config-php-codes-highlighted.png\/public\" alt=\"The wp-config.php file on the public_html directory, highlighting the scripts\" class=\"wp-image-101592\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/01\/file-manager-wp-config-php-codes-highlighted.png\/w=880,fit=scale-down 880w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/01\/file-manager-wp-config-php-codes-highlighted.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/01\/file-manager-wp-config-php-codes-highlighted.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/01\/file-manager-wp-config-php-codes-highlighted.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><\/a><\/figure><\/div><ol class=\"wp-block-list\" start=\"4\">\n<li>Navigate to <strong>phpMyAdmin<\/strong> <strong>-&gt;<\/strong> <strong>SQL<\/strong> and redirect all posts to the new domain by running this command in the SQL database. Finding your <a href=\"\/ng\/tutorials\/wordpress\/how-to-find-out-wordpress-database-name\">WordPress database name<\/a> is very simple, you just need to follow our guide.<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">UPDATE wp_posts SET post_content =\nREPLACE(post_content,'www.yourwebsite.com\/wp-content\/','static.yourwebsite.com\/')<\/pre><p>Once that&rsquo;s done, static.yourwebsite.com will deliver all static content without cookies.<\/p><p>Another way of using a cookie-free domain is to set up a <a href=\"\/ng\/tutorials\/what-is-cdn\">content delivery network<\/a> (CDN) like <a href=\"https:\/\/www.keycdn.com\/\">KeyCDN<\/a> and <a href=\"https:\/\/www.cloudflare.com\/\">Cloudflare<\/a>.<\/p><p>If you use KeyCDN, enabling the <strong>Strip Cookies<\/strong> feature will stop the server from sending <strong>Set-Cookies<\/strong> headers in response to HTTP requests. The<strong> Cache Cookies <\/strong>setting allows users to ignore all cookies.<\/p><p>This will help the website load faster, and the user will no longer get the cookie-free error.<\/p><h2 class=\"wp-block-heading\" id=\"h-benefits-of-using-cookie-free-domains\">Benefits of Using Cookie-Free Domains<\/h2><p>Cookie-free domains are an essential part of website optimization efforts &ndash; even GTmetrix includes in its scoring metrics. GTmetrix displays a cookie-free error for websites that don&rsquo;t use a cookie-free domain as their server is deemed unoptimized, harming the site&rsquo;s overall score.<\/p><p>Using cookie-free domains can bring several benefits for your website, including:<\/p><ul class=\"wp-block-list\">\n<li><strong>Less network traffic<\/strong> &#8210; using a different domain to serve static content lets you reduce unnecessary cookie traffic on the server.<\/li>\n\n\n\n<li><strong>Faster loading speed<\/strong> &#8210; this particularly applies to static content, as cookie-free domains don&rsquo;t require that the users&rsquo; browsers store cookies for them.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>When analyzing your site&rsquo;s performance using a tool such as GTmetrix, you might have found the cookie-free error. It might seem complicated at first, but it is not difficult to solve it &ndash; you can set a cookie-free subdomain or change your CDN settings.<\/p><p>We hope this article helped you learn what cookie-free domains are and how to set them up on WordPress to improve your traffic, SEO, and user experience. Good luck!<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">Learn More About Website Maintenance<\/h4>\n                    <p><a href=\"\/ng\/tutorials\/website-maintenance-cost\">Website Maintenance Cost<\/a><br>\n<a href=\"\/ng\/tutorials\/hacked-website\">How to Diagnose and Fix a Hacked Website<\/a><br>\n<a href=\"\/ng\/tutorials\/hotlinking\">Hotlinking: What Is It and Why Is It Bad?<\/a><br>\n<a href=\"\/ng\/tutorials\/clear-browser-cache\">How to Clear Browser Cache and History<\/a><br>\n<a href=\"\/ng\/tutorials\/website\/how-to-inspect-and-change-style-using-google-chrome\">How to Inspect Element<\/a><br>\n<a href=\"\/ng\/tutorials\/backups\/downloading-website-backup\">How to Download a Website Backup<\/a><br>\n<a href=\"\/ng\/tutorials\/specify-vary-accept-encoding-header\">How to Fix &ldquo;Specify a Vary<\/a><br>\n<a href=\"\/ng\/tutorials\/website\/how-to-check-your-website-error-log\">How to Check Your Website&rsquo;s PHP Error Log<\/a><\/p>\n                <\/div>\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Website speed has a great impact on user experience, traffic, and SEO. Several tools, such as GTmetrix, allow you to check your website speed, giving warnings and recommendations according to its weak spots. If your site is experiencing slow load times or GTmetrix displays a cookie-free error when analyzing your web performance, you may want [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/cookieless-domain-warning\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":115,"featured_media":144761,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Use Cookie-Free Domains for WordPress - Step-by-Step","rank_math_description":"Not sure what are cookie-free domains? Wonder what are the benefits of using a cookie-free domain? Read this tutorial and find out!","rank_math_focus_keyword":"use cookie-free domains","footnotes":""},"categories":[22637],"tags":[],"class_list":["post-18117","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/cookieless-domain-warning","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/cookieless-domain-warning","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-use-cookie-free-domains","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-use-cookie-free-domains","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/cookieless-domain-warning","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/cookieless-domain-warning","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/cookieless-domain-warning","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/cookieless-domain-warning","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/18117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=18117"}],"version-history":[{"count":21,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/18117\/revisions"}],"predecessor-version":[{"id":144760,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/18117\/revisions\/144760"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media\/144761"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=18117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=18117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=18117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}