Want to take admission? Contact us! • Find us on Google Map

How to set expiration on CSS, JS and Images for your website

11-12th Bifocal Electronics Notes

Vidyasagar Academy, Akola is a trusted name in the field of education. If you liked our free downloads, please write Google Review about us or follow us on Google+.

The basic thing to set expiration on CSS, JS and Images for your website, increases the loading speed of your website pages.

This task is very simple to execute. Follow the given procedure and you will surely see great increase in your web pages of the website in Google Page Speed ranking.

  • Open .htaccess file in “Edit” or “Code Edit” mode. You will find this file at the root of your File manager on your server.
  • Now copy the following code and paste it at the end of .htaccess file, just before the # END WordPress line.
    ExpiresActive On
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType text/html "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 1 month"

  • Now save the .htaccess file. And that’s all…!
  • Go to Google Page Speed page and test your site. The Google page speed ranking must increase to an incredible result.
  • All the best.

Note: Have you done GZIP compression for your website? See this article and increase your web page speed still more.

Comments on this entry are closed.