how to use cookie-free domains (yslow)
Asked Answered
D

3

22

I was trying to solve the problem with cookie-free, the yslow has suggested to create a subdomain. I did, but the yslow still "show" the problem.

i didn't set the cookie´s domain in the page, cause i don't know how to do it.

anyone know a tutorial or a solution to this problem?

Domestic answered 3/10, 2014 at 20:30 Comment(0)
P
11

Create a subdomain such as static.yourwebsite.com which is where you will deliver all your static files from.

Point your new subdomain to the /wp-content directory for a WordPress installation.

For cPanel users, you will need to update the document root field from public_html/static to public_html/wp-content like the screenshot below. cpanel document root

Edit your config.php file to reflect the following:

define("WP_CONTENT_URL", "http://static.yourwebsite.com");

define("COOKIE_DOMAIN", "www.yourwebsite.com");

Now that your cookie domain and static content subdomain are set, you can begin delivering static content without the server setting an unnecessary cookie for static assets.

https://www.keycdn.com/support/how-to-use-cookie-free-domains/

Polk answered 17/3, 2017 at 1:42 Comment(2)
should i install new word press for static.yourwebsite.com" or same wordpress of www.yourwebsite.com/wp-content?Glossary
config.php = wp-config.phpReamer
W
5

To work around this problem, make sure that static components are requested with cookie-free requests by creating a subdomain and hosting them there.

If your domain is www.example.org, you can host your static components on static.example.org. However, if you've already set cookies on the top-level domain example.org as opposed to www.example.org, then all the requests to static.example.org will include those cookies.

In this case, you can buy a whole new domain, host your static components there, and keep this domain cookie-free.

Yahoo! uses yimg.com, YouTube uses ytimg.com, Amazon uses images-amazon.com and so on.

Read More

Warmongering answered 4/3, 2015 at 7:34 Comment(0)
D
1

Serve static content from a different domain to avoid unnecessary cookie traffic. When the browser requests a static image and sends cookies with the request, the server ignores the cookies. These cookies are unnecessary network traffic.

  1. Move all your static content on a different domain, where no cookies are set.
  2. Move your static content on a different sub domain and set all the cookies to the www subdomain.
Duggins answered 14/3, 2016 at 14:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.