简体   繁体   中英

How to leverage browser cache and serve from a cookieless domain with a subdomain? (with cdn)

I am using W3 Total Cache on Wordpress with Amazon Cloudfront as my CDN. But when I run my site through the Pingdom Website Speed Test, it still says I need to 'Leverage browser caching' and 'Serve static content from a cookieless domain'. I noticed that the links affected are my cdn.domain.com links so I'm wondering if it's possible to leverage browser cache on my subdomain and set it to be cookieless?

1) The problem is that Wordpress doesn't send cache info at user uploaded files, also W3 Total Cache doesn't fix this. Here some example how to fix this: http://www.askapache.com/hacking/speed-site-caching-cache-control.html

2) To avoid that the browser send cookies to your cdn subdomain you have to be sure that site is launched at www.yourdomain.com and not yourdomain.com. Redirect the visitor to www.yourdomain.com when the visitor entered only the domain name. You can edit the .htaccess file in the root of your site, see: http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM