How To Use Cookie-Free Domains in WordPress?

How To Use Cookie-Free Domains WordPress

Team Leader Asked on November 17, 2018 in WORDPRESS.
Add Comment
1 Answer(s)

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.

IT Head Answered on November 17, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.