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"

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

curl --dump-header headers 

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:
Help Desk Software by Kayako fusion