Correct regexp for Apache Expires headers


I am trying to get my Apache/Passenger installation to cache all
assets with a Rails style timestamp. My vhost file contains:

<VirtualHost *:80>
DocumentRoot /home/deployer/public/blabla/public

    <Directory /home/deployer/public/blabla/public>
            <IfModule mod_expires.c>
                    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|

ExpiresActive on
ExpiresDefault “access plus 10 years”

If I use the “catch all” regexp “.(ico|pdf|flv|jpg|jpeg|png|gif|js|
css|swf)$” then the assets get expires headers, but not if I include
the demand for a ? and 1 or more digits. I have checked the Perl
regexp documentation and I cannot see what is wrong with it. It also
runs well in Ruby, though I am not 100% of the compatibility between
Ruby and Perl regexp.

Does anyone have a working regexp for this?


Erik L.

I got the same problem.

Just read an article on this here:
In short, Apache doesn’t seem to support file matching with the query


Jeff Tucker

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs