Check your site in google insights page speed. You will get a error "Leverage Browser Caching", if your server doesn't add caching headers to your site. If you add expires headers to your .htacces file, then you will get better site speed. Expires headers tells browser whether they should request file from browser or whether they should grab it from browser's cache. Its not only reduce the loads of download from server but rahter to reduce the number of http requests for the server.
Example:
<IfModule mod_expires.c>
# Enable Expiration
ExpiresActive On
# Default Directive
ExpiresDefault "access plus 1 month"
# Favicon
ExpiresByType image/x-icon "access plus 1 month"
# Images
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
# Css
ExpiresByType text/css "access plus 1 month"
# Javascript
ExpiresByType application/javasacript "access plus 1 month"
# Html
ExpiresByType text/html "access plus 1 month"
# Xml
ExpiresByType application/xhtml+xml "access plus 1 month"
# Manifest files
ExpiresByType application/x-web-app-manifest_json "access plus 1 month"
ExpiresByType text/cache-manifest "access plus 1 month"
# Media
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
# Web feeds
ExpiresByType application/atom+xml "access plus 1 month"
ExpiresByType application/rss+xml "access plus 1 month"
# Web fonts
ExpiresByType application/font-wof "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>
Explation:
Where,
mod_expires.c allows setting by file type to control how long browsers cache file.
ExpiresActive enable the expires.
ExpiresByType represents the type of file like image, html ...
"access + 1 month" means how long the file type cached by browser.
Related Post:
Example:
<IfModule mod_expires.c>
# Enable Expiration
ExpiresActive On
# Default Directive
ExpiresDefault "access plus 1 month"
# Favicon
ExpiresByType image/x-icon "access plus 1 month"
# Images
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
# Css
ExpiresByType text/css "access plus 1 month"
# Javascript
ExpiresByType application/javasacript "access plus 1 month"
# Html
ExpiresByType text/html "access plus 1 month"
# Xml
ExpiresByType application/xhtml+xml "access plus 1 month"
# Manifest files
ExpiresByType application/x-web-app-manifest_json "access plus 1 month"
ExpiresByType text/cache-manifest "access plus 1 month"
# Media
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
ExpiresByType application/atom+xml "access plus 1 month"
ExpiresByType application/rss+xml "access plus 1 month"
# Web fonts
ExpiresByType application/font-wof "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>
Explation:
Where,
mod_expires.c allows setting by file type to control how long browsers cache file.
ExpiresActive enable the expires.
ExpiresByType represents the type of file like image, html ...
"access + 1 month" means how long the file type cached by browser.
Related Post:
What is htaccess?
Restrict users to access pages from site using .htaccess
Compressing resource with gzip using .htaccess
How to create error document using .htaccess
How to add MIME types using .htaccess
How to enable SSI using .htaccess
How to force script to display as source code using .htaccess
How to prevent access to php.ini file using .htaccess
How to enable or disable directory list using .htaccess
How to redirect urls using .htaccess
How to redirect to www using .htaccess
How to enable short tag in php using .htaccess
How to access pages through one page in site using .htaccess
Restrict users to access pages from site using .htaccess
Compressing resource with gzip using .htaccess
How to create error document using .htaccess
How to add MIME types using .htaccess
How to enable SSI using .htaccess
How to force script to display as source code using .htaccess
How to prevent access to php.ini file using .htaccess
How to enable or disable directory list using .htaccess
How to redirect urls using .htaccess
How to redirect to www using .htaccess
How to enable short tag in php using .htaccess
How to access pages through one page in site using .htaccess