Want to take admission? Contact Us • Find us on Google Map • Write Google Review about us!

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

11-12th Bifocal Electronics Notes

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.

About the author: “VSAcademy” is the admin authority of Vidyasagar Academy for this website. The admin is also the official representative of independent activities like Robotics Study Club and Web Designing Courses for publishing posts, articles, news, and current information regarding our activities. Know more about us and our activities. Google+TwitterFacebookPinterest

Comments on this entry are closed.

%d bloggers like this: