How to Add or Fix Expires Headers To Your Website or Wordpress Website

How to Add or Fix Expires Headers To Your Website or Wordpress Website. Browser caching will tell a visitor browser to save few website files on the visitors computer locally & use those local files whenever required.

How to Add or Fix Expires Headers To Your  Website or Wordpress Website

What are Expires Headers?

Expires headers tells the browsers about what kind of resources can be stored & fetched from the web browsers cache . By this method,  it willl helps user's site load faster by providing  data stored locally on computer or mobile cache without downloading that files from the server.

To make it expire header happen, it need to be set properly in the website by adding code in .htaccess  files  of your code. By adding code, the web browser will stores that files as cache for a defined or set period of time.

For example, if we set expires headers for  .css or .png or .jpg files, then the browser will store all the .css or .png or .jpg files as a cache file in pc or computer or mobile browser. By this method visitor can able to load their website  faster as the browser has already cached those file related to the that paticular website.

By using expires headers on your website , user can increase their website speed. By adding expires headers, it will reducing HTTP requests.

What are Browser caching?

Browser caching will tell a visitor browser to save few website files on the visitors computer locally & use those local files whenever required.


Why Expiration Headers are so Important?

    1. Expires headers  will reduce website load time & thus povide faster loading speed.
    2. Expires headers helps in reducing HTTP requests of your website.
    3. It gives web server more room  to manage other files requests at that particular time.

Add the following code into your website  .htaccess file and save it..


ExpiresActive On
# Images
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/webp "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
# Video
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/mpeg "access plus 1 month"
# CSS, JavaScript
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
# Others
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"

What's Your Reaction?

like
-9
dislike
7
love
-11
funny
4
angry
10
sad
-1
wow
8