Knowledge Base

Set Up Apache Cache Control

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" 


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.

Did you find this article helpful?

* Your feedback is too short