Jump to content

Mod_expires


natimage

Recommended Posts

OK...lets see if I understand this correctly:

 

ExpiresActive On

# Set default expiry to six hours after last access

ExpiresDefault A21600

# Set expiry for image files to 30 days

ExpiresByType image/gif A2592000

ExpiresByType image/jpeg A2592000

# Set expiry for error pages to zero

<FilesMatch "^(error¦forbidden)\.html$">

ExpiresDefault A0

</FilesMatch>

 

This should go into the .htaccess file of my public_html folder in order to apply the following rules to all documents within the public_html folder:

 

set default expiration to 6 hours after last access

set expiration to 30 days for gif and jpg files

set expiration to 0 for error pages

 

Question..can the comments in the script be left in the .htaccess file?

 

Is there anything else I need to do to set this up?

 

Thanks!

 

OH...can someone explain to me why A2592000 30 days after access? I don't understand the logic of those numbers.

Edited by natimage
Link to comment
Share on other sites

'Nuther question. I read this in another forum that I found through google:

 

I think one point that is sticky is this: Apache won't serve Last-Modified or Expires headers on files which SSI-include other files.

 

Is that referring to things like, php includes for header and footer files?

Link to comment
Share on other sites

Is that referring to things like, php includes for header and footer files?

No, that's only for SSI.

 

Also, I'd like to say that you don't have to use this Axxxxx syntax. You can simply write,

 

ExpiresByType image/jpeg "access plus 30 days"

 

or

 

ExpiresByType image/jpeg "modification plus 1 year"

Link to comment
Share on other sites

I've put the code into my .htaccess file in public_html folder. I've used a "Server header Checker" tool, but can't make heads or tails of most of it. Is there some other way of knowing whether or not my code is working?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...