Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

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.