Go to content Go to navigation Go to search

People

Businesses

Mod Expires 28 July 2007

Yahoo! recently released an amazing tool called “YSlow”. It helps analyze the pages you’ve built and find problem points and bottlenecks. As bradleyboy said, there is nothing quite like working to fix that letter grade.

I needed to modify the Expires times on one of my servers, but it’s not a VPS, so I don’t have access to the php.ini file (php configuration file). Luckily, I can use a .htaccess file on most of the servers I’ve got to administer to set the expires time:

ExpiresActive On
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/css "access plus 6 months"

The first line turns on ExpiresActive (obviously?). The next four lines make sure that the server knows that image files should expire from the client browser’s cache every month. And the last line makes sure that the css is cached by the browser for about six months.

If you look over here, at the old mod_expires docs you can find a list of all the keywords and settings you can use to expire everything on your server at the right moment.

Sphere: Related Content

Comments

  1. Yslow is a sweet little firefox add-on. I just downloaded, and installed it. I hope I can start using it on websites I make to learn if I can make them a little more web efficient.

    Josh Minnich    Jul 29, 08:30 AM    #
     

Leave a Comment