1

The site has been coded by me from scratch. Not a wordpress site. I ran a site audit and naturally theres a lot to be done; one of which is page caching. Im a beginner at coding, its my first site and I've hosted it and its running now.

I have added the http-eqiv tag "< meta http-equiv="cache-control" content="public" >". Thats all the work that's been done for page-caching, I was told that was all that was needed to be done. But after running a second site audit it still says "page-caching is not enabled".

Please help me out with this guys. Ive seen a bunch of Http "tutorials" but no help really. I was hoping for step by step tutorials.

  • Have you set up an `.htaccess` file? If so, you’d need to put something like `ExpiresActive On`, `ExpiresByType image/png "access plus 1 month"`, etc. in it. – Sebastian Simon Aug 23 '15 at 00:54
  • No I don't have that file, how do I go about setting that up? – Joshua Tabansi Aug 23 '15 at 16:32
  • Hm… just make an empty file, call it `.htaccess` and put it in the same directory as your website (HTML file). Then look into the above directives (`ExpiresActive` and `ExpiresByType`) to enable caching. That should actually enable caching. At least it worked for my site. – Sebastian Simon Aug 23 '15 at 16:35
  • Awesome, would get back to you in a bit – Joshua Tabansi Aug 23 '15 at 17:33

1 Answers1

1

Generally, you can enable caching of website content by creating an empty file, naming it .htaccess and moving it into the same folder as your HTML file (if you have access to your server’s FTP). Then you can write this inside it:

ExpiresActive On
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"

etc. For each file type, you add a reasonable amount of time to be cached (for example a month for each picture, a day for each HTML site, etc.).

When I did this for my site, Google PageSpeed Insights always pointed out the resources that were not cached yet, so it was easy to find out which lines to add.

Sebastian Simon
  • 18,263
  • 7
  • 55
  • 75