Setting Expires HTTP header on server response through Apache
In recent poc, i have set the expires HTTP header on server response for one of the project, such that it will again set when access by user for the specified period, if header is expired already.
The module that control it is “mod_expires.c”. This module is not enabled by default.
You need to enable it by following command (You need to be sudo user):
a2enmod {module name} //here module name is "expires"
Then, open your site configuration file available at apache2/sites-available/{your site}
Append following xml entries in your site configuration file :
ExpiresActive On
ExpiresDefault "access plus 2 days"
ExpiresDefault Syntax :
ExpiresDefault "{base} [plus] {num type}*"
Note : Here base is : ‘access’ and the type is : ‘years’, ‘months’, ‘weeks’, ‘days’, ‘hours’, ‘minutes’, ‘seconds’
You can also use “ExpiresByType” for setting different expires for different file type instead of “ExpiresDefault”.
Hope this code will help 🙂
Regards,
Tarun Pareek
Intelligrape Software
But wanna input that you have a very nice web site , I like the layout it actually stands out.