Knowledgebase: How-To
Set Up Apache Cache Control
Posted by on 02 July 2012 11:09 AM

To implement cache-control with shared hosting, place the mod_expires directives in your .htaccess file.

For example, if you have scripts located in '~/public_html/javascripts/', make a new .htaccess file in that directory with the following contents:

ExpiresActive On
ExpiresDefault "access plus 1 week"


You can wrap an IfModule around that if you want:

<If Module mod_expires.c>
>ExpiresActive On
ExpiresDefault "access plus 1 week"
</IfModule>


The easiest way to check if this is actually working is with cURL. On a separate UNIX box, run

curl --dump-header headers https://www.mydomain.com/help/article/scripting-introduction-to-php 

Note: on servers with out Nginx Acceleration Stack, changes to expiry headers will be ignored and overwritten by Nginx.

 

Then check the output with cat headers. If you see Cache-Control: max-age=604800 then you're set (604800 is a week in seconds).

The ASO Forums have a more detailed discussion of this.

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
Help Desk Software by Kayako fusion
ERROR: This domain name (kb.asmallorange.com), does not match the domain name in the license key file help.asmallorange.com.

For assistance with your license, please contact the Kayako support team: https://support.kayako.com