ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

ExpiresDefault help in htaccess

December 03, 2010 1:41pm

Subscribe [3]
  • #1 / Dec 03, 2010 1:41pm

    inphantry

    12 posts

    Hi All,

    I have a huge JS file (300k compressed) so I’m trying to get the browser to cache it so that return visits and interior page loads will be much faster.  Here is the code I am using in my htaccess file:

    <FilesMatch “\.(ico|jpg|jpeg|png|gif|js|css|swf)$”>
    ExpiresDefault “access plus 2 hours”
    </FilesMatch>

    <FilesMatch “(sitewidemin)$”>
    ExpiresDefault “access plus 2 hours”
    </FilesMatch>


    The first one works fine for normal images and what not, but doesn’t cache the js or css files since the URL for them doesnt include .js

    Here is the line where I am loading it into the HTML:

    [removed][removed]

    What am I doing wrong here?

    Thanks!

  • #2 / Dec 03, 2010 2:41pm

    cherrypj

    158 posts

    Take a look at using ExpiresByType. Greg Aker has a nice overview of his .htaccess file, but you can also look at the HTML5 Boilerplate .htaccess file.

  • #3 / Dec 03, 2010 4:14pm

    Sue Crocker

    26054 posts

    .htaccess questions are better served in the CodeShare Corner forum. Moving for additional community support.

  • #4 / Dec 03, 2010 6:17pm

    inphantry

    12 posts

    I tried using that and the js files are still returning a 200OK status and reloading each time… I also turned off ExpressionEngine > Output and Debugging > Generate HTTP Page Headers thinking maybe that was overriding what I was doing… Still no luck

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases