# far future expires headers
ExpiresActive On
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)?d{10}$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
I'm not using 10 years though, this is just an example script. I also
tried:
# add something we can do a directory match on
RewriteCond %{QUERY_STRING} ^[0-9]{10}$
RewriteRule ^(.*)$ /add_expires_header%{REQUEST_URI} [QSA]
# the add_expires_header directory is just a symlink to public
<Directory "/path/to/rails_app/public/add_expires_header">
ExpiresActive On
ExpiresDefault "access plus 10 years"
</Directory>
and added the symlink for :
cd /path/to/rails_app/public
ln -s . add_expires_header
The problems I face are the following:
I want to use expire headers with all of the following content:
ico>pdf>flv>jpg>jpeg>png>gif>js>css>swf
I also want the expire headers to work with images being loaded from CSS
files. Rails puts the datetime stamp on all of my content so it should
work with the ?datetimestamps too.
I'm sure someone here has setup something that works well. I could use
some help to get this working. In my case, sometimes the rails
?timestamps are ignored and YSlow shows the content not being expired...
I decided to wait 24 hours before rebumping my thread. I still could
use some assistance with this. I'm not sure how many out there use
expire headers but I would like to accomplish this task with rails.
Please look over my former response and if you have expires headers
working with your site, I could use some pointers for mine.
Well those don't have a timestamp on them so don't match your
filesmatch clause. Have you tried fiddling with the regular expression
(or using ExpiresByType) ?
ExpiresDefault worked great for css, js, and swf
ExpiresBytype worked great for all images, including those within css
I pushed the expires to access plus 4 months since that's the football
season length and if any site modifications occur, they'll happen after
that time.
My site now grades out as an A in Expire Headers with YSlow.
Overall, my entire site grades out as a B with YSlow, almost at an A.
It's pretty speedy too.
My site now grades out as an A in Expire Headers with YSlow.
Overall, my entire site grades out as a B with YSlow, almost at an A.
It's pretty speedy too.
Don't put too much faith in YSlow. Remember that it was designed to be
an internal tool at Yahoo!. That means that it's great if you're Yahoo!
or if you have similar usage patterns, but if you don't, it can be very
misleading. For example, on my projects, I've found most components of
it nearly useless.