How To Use Cookie-Free Domains in WordPress?
How To Use Cookie-Free Domains WordPress
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
Use cookie-free domains in WordPress:
1.Create a subdomain such as static.example.com which is where you will deliver all your static files from.
2.Point your new subdomain to the /wp-content directory of your WordPress installation. For cPanel users, you will need to update the document root field from public_html/static to public_html/wp-content.
3.Edit wp-config.php file as below:
define("WP_CONTENT_URL", "http://static.example.com");
define("COOKIE_DOMAIN", "example.com");
4.Run the following command in your SQL database.
UPDATE wp_posts SET post_content = REPLACE(post_content,'example.com/wp-content/','static.example.com/')
Your cookie domain and static content subdomain are set.Now you can begin delivering static content without the server setting an unnecessary cookie for static assets.