Adding Apache Module mod_expires to your .htaccess?

Philippe Gaucher

Well-known member
Collaborate
Registered
Joined
Jul 27, 2016
Messages
184
Points
18
When visiting a website, the website content will be cached in your web browser. This cache can be controlled by configuring your Cache-Control HTTP headers for your website. This is done by adding mod_expires in the .htaccess file of your server. I heard about this but I don't know where & how to enable it? Is there a limited time to tell your browser clear your cache? if so, how long should I put in my htaccess file?
 

GswHosting

Well-known member
Registered
Joined
Aug 23, 2016
Messages
233
Points
0
Hi,
don't know if you find it but here is two ways
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
and
<ifmodule mod_expires.c>
<Filesmatch "\.(jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3)$">
ExpiresActive on
ExpiresDefault "access plus 2 days"
</Filesmatch>
</ifmodule>

For time not sure, maybe short for txt and longer for multimedia
try to google for time and more details
 

Philippe Gaucher

Well-known member
Collaborate
Registered
Joined
Jul 27, 2016
Messages
184
Points
18
Cool GswHosting, I added to my site but I could not know how to check if it is enabled.

and there is another way to do these tasks without adding codes on httacess file. I mean I want to do it on my hosting control panel.
 
Older Threads
Replies
2
Views
1,861
Replies
5
Views
2,895
Replies
7
Views
4,770
Latest Threads
Replies
0
Views
24
Replies
0
Views
70
Replies
1
Views
223

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top