Jump to content

Problems with Apache and Future Expires


whit3fir3

Recommended Posts

I have a site I am working on with lots of images.  A vast majority of these images are being stored in a MySQL database.  I am trying to turn Future Expires headers on so clients do not have to download the images every time they visit the site, but I am having problems getting the headers to work for images that are stored in the database.

 

I have added the following to my Apache Site config and it works great for everything but database images:

 

<FilesMatch "\.(jpg|jpeg|png|gif|js)$">
ExpiresActive On
ExpiresDefault "access plus 1 year"
</FilesMatch>

 

I have played with this some trying to get it to work with images that are stored in the database.  The latest attempt was the following:

 

<FilesMatch "\.(jpg|jpeg|png|gif|js|image.php?cid=^\d{1,7}$)$">
ExpiresActive On
ExpiresDefault "access plus 1 year"
</FilesMatch>

 

The name of the file that gets the images out of the database is called image.php.  This looks for 1 of 2 URL variables to be passed to it named either iid or cid.  The values for these variables are numeric and currently 4 digits in length.  I tried adding a regular expression to handle the numeric values that might be passed to the image file, but apache did not seem to like that.  Any ideas of what I might be doing wrong here?

 

Thanks,

 

Whit3fir3

Link to comment
https://forums.phpfreaks.com/topic/184596-problems-with-apache-and-future-expires/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.