mojobullfrog
mojobullfrog

Reputation: 189

cache control not working properly

I've placed a simple cache control in my .htaccess file:

#cache css and javascript files for one week  
<FilesMatch ".(js|css)$">  
Header set Cache-Control "max-age=604800"  
</FilesMatch>

When I test the desktop site at Google's Page Site tester: https://developers.google.com/speed/pagespeed/insights ... it shows the javascript and images are being cached properly. However, when I test my mobile website, the caching isn't working. My htaccess file is contained in the public_html directory alongside all my desktop files (ie. public_html/index.html, public_html/images/, public_html/css/, public_html/.htaccess etc.) My mobile site is contained here: public_html/mobile/.

Would I need to add a second .htaccess file to the mobile directory to make it work?

Thanks.

Upvotes: 0

Views: 456

Answers (1)

Anand mohan sinha
Anand mohan sinha

Reputation: 588

The best option is to use .htaccess file of html5 boilerplate. It is highly optimised for cache,gzip,cross-domain ajax plus a lot of features.

Also do check whether mod_deflate is on or not.

You don't need any additional .htaccess file just use a single file in the root of your directory.

Upvotes: 1

Related Questions