How to add Expires headers in .htaccess

Expires headers tells the browser where a resource on the website needs to be requested from the source. It tell the browser that how long it should keep the cached files from the site. the benefits of the settings expires headers to control the browser caching. You can restrict it by period.
Just add this code in the .htaccess file.

# BEGIN Add Expires Headers Plugin
<IfModule mod_expires.c>
ExpiresActive on
#image
ExpiresByType image/gif A31104000
ExpiresByType image/ico A31104000
ExpiresByType image/jpeg A31104000
ExpiresByType image/jpg A31104000
ExpiresByType image/png A31104000
ExpiresByType image/tiff A31104000
ExpiresByType image/webp A31104000
#audio
ExpiresByType audio/dct A31104000
ExpiresByType audio/gsm A31104000
ExpiresByType audio/mp3 A31104000
ExpiresByType audio/ogg A31104000
ExpiresByType audio/raw A31104000
ExpiresByType audio/vox A31104000
ExpiresByType audio/wav A31104000
#video
ExpiresByType video/3gp A31104000
ExpiresByType video/avi A31104000
ExpiresByType video/flv A31104000
ExpiresByType video/mkv A31104000
ExpiresByType video/mp4 A31104000
ExpiresByType video/webm A31104000
ExpiresByType video/wmv A31104000
#font
ExpiresByType font/otf A31104000
ExpiresByType font/ttf A31104000
ExpiresByType font/woff A31104000
ExpiresByType font/woff2 A31104000
#text
ExpiresByType text/css A31104000
#application
ExpiresByType application/js A31104000
ExpiresByType application/javascript A31104000
ExpiresByType application/x-javascript A31104000
</IfModule>
# END Add Expires Headers Plugin

First we activate the "expirations" . then we add the different lines for every file with expiration date,

it will work and you will returned back good result in SEO.

Leave a Reply

Your email address will not be published. Required fields are marked *