{"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\/w=1024,h=1024,fit=scale-down\" 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=\"\/ng\/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\/w=1024,h=1024,fit=scale-down\" 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\/ng\/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            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Learn More About Website Maintenance                <\/p>\n            <\/div>\n            <p class=\"protip__content\"><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        \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":1},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-use-cookie-free-domains\/","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-use-cookie-free-domains\/","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/cookieless-domain-warning\/","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}]}}