Way to add expires header to images with Godaddy shared Linux hosting

.htaccessapache-2.2godaddyhttp-headers

I can't find a way to do it. Is it even possible?

Best Answer

You could create a custom script and redirect all your images to that script. It's kind of a big overhead but it works if it's your only option.

For example

http://yoururl.com/img.php?image=banner.jpg

And that script would contain for example:

<?php
header('Expires: full_date_comes_here');

echo file_get_contents('images/'.$_GET['image']);
?>

Note!!! This is just a dummy example and you should add validation to your script, to prevent attacks using "../" parts etc.

Related Topic