All new hosting and maintenance clients receive a free HOUR of support each month for theme or plugin fixes, site optimization or malware removal!
GET FREE WP FIX NOW! While there are many different things you can do in order to make your site faster I'm going to post a little snippet to add in your .htaccess file that will set your Expire Headers time.Expire Headers is letting your browser to cache your website content and request them only after the time specified in that rule expires.
If you want to set Expire Headers for all of your image,js and css file you have to open and edit your .htaccess file and the following rule:
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css|woff)
quot;> ExpiresActive On ExpiresDefault A2592000 </FilesMatch>
FilesMatch sets the file extensions that are affected by the ExpiresActive rule while the ExpiresDefault sets the cache time, when that time expires then your website visitor browser will request once more the files.
ExpiresDefault is access time (A) plus 30 days (2592000 seconds), so using the same rule you can set your own ExpiresDefault time(just be careful to calculate in seconds).
If you want to set a separate Expire Headers rule for each of your filetypes then you can use the following snippet on your .htaccess.
ExpiresByType image/png A2592000 ExpiresByType image/gif A2592000 ExpiresByType image/jpg A2592000 ExpiresByType image/jpeg A2592000 ExpiresByType text/javascript A2592000 ExpiresByType application/x-javascript A2592000 ExpiresByType text/css A2592000
All new hosting and maintenance clients receive a free HOUR of support each month for theme or plugin fixes, site optimization or malware removal!
GET FREE WP FIX NOW!WordPress is a widely popular Content Management System (CMS) that powers over 40% of all…
WordPress is a popular platform that empowers more than 60 million websites worldwide. Millions of…
In this article, we will cover ten crucial WordPress site maintenance tasks that every website…
In this blog article, we will explore the various WordPress security solutions you can implement…
Plugins are an integral part of WordPress, as they offer countless benefits and features that…
In this article, we will explore various strategies that can help you enhance your WordPress…
View Comments
Thanks for your sharing.
Now, my web more fast
I tried in my site and not working.
Did you get any error? How did you test for not working?
Well Its working like a charm. Thank You so bro :)
Hello,
I am using WP super cache plugin. can i use this tip along with the plugin. Just i tried. .htaccess is not supporting (means Site showing 500 internal error). Thank you.
Regards
Satish Kumar Ithamsetty
http://www.BloggingDen.com
Hi Satish Kumar.
500 error means your server is not compatible with .htaccess or some of the .htaccess directives are wrong.
I suggest you first try it with WP Super Cache disabled and add directives one by one, if you are still having issues then stick just with the WP Super Cache which either way should be more than enough.
I've used far future expiry plugin for add expires in header but gtmetrix Yslow still showing that "Add expires in header". Let me know what I can do for it.
Usman I suggest you do some research on the logs of GTMetrix.
Well Its working, my Web Speed 89%
Thank You
This information is very useful, my website is responding very well.
Thank you Very much . I used your code and Now google PageSpeed Insights increased from 56 to 67 ( mobile ) and in dexto 70 to 86 . Now my website is responding very fast. :D
Htaccess is not working on Nginx. Apache only.
nice its woking