My website is built with WordPress and I'm using a combination of the plugins W3 Total Cache and Autoptimize to make my website faster.

My settings seems to be correct and most optimisation efforts are working as it should, but Google PageSpeed Insights are still suggesting that I should "Leverage browser caching" for my images. The WP site is on the main domain (mydomain.com) where as the images are uploaded to a subdomain (media.mydomain.com).

So now even though I have enabled leverage browser caching for media etc. in W3 Total Cache, PageSpeed says that the images on media.mydomain.com expires only after 5 minutes, but my settings says 31536000 seconds for media.

Are images on the subdomain not covered by the .htaccess settings generated by W3 Total cache? Should I add a similar .htaccess file to the root of media.mydomain.com to make it work, or can I tweak the settings in W3 Total Cache to cover this as well?

  • What happened when you uploaded a similar htaccess to the sub-domain ?
    – user29671
    Aug 17, 2015 at 19:46

2 Answers 2


If your site is a medium or small traffic one, I would recommend you to keep the images in the same domain as WordPress does it by default and enable the jetpack by WordPress to get more speed and performance.


Your W3 Total Cache and .htaccess on the main domain will not work on your sub domains.

Copy across your main URLs htaccess caching code to the sub domains and see how that responds.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.