Forum Moderators: phranque
Is there any alternative ?
I just want to set an expire value for all my pictures with are many smileys and icons (jpg, gif, )... Something equivalent to
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/x-icon A26611200
ExpiresByType application/x-javascript A1814400
ExpiresByType text/css A1814400
ExpiresByType image/gif A26611200
ExpiresByType image/png A26611200
ExpiresByType image/jpeg A1814400
ExpiresByType text/plain A300
ExpiresByType application/x-shockwave-flash A1814400
ExpiresByType video/x-flv A1814400
ExpiresByType application/pdf A1814400
ExpiresByType text/html A300
ExpiresByType text/php A0
</IfModule>
Can I do the same using the header() function ?
Thank you
If you're really convinced that ROI on your site won't justify better hosting, you could (perhaps) use mod_rewrite to send all requests for image URLs to a script, which could output the appropriate cache-control and content-type headers, open the requested file locally, read it in, and then send the contents to the client.
This presumes that you're allowed to use mod_rewrite -- maybe not a good assumption if you can't use those other two modules.
I've got several small sites on $7.95/month shared hosting, with no such restrictions...
Jim
Indeed, I am considering to move to another host... But, at the same time, I am quite happy with the one I have currently, so... Don't know...
Thanks for your rewrite/redirect idea. By the way, mod_rewrite is allowed.
Yeah, I really don't know why there is a restrictions for mod_header.
Thanks
<img src="http://www.example.com/image.gif"> you'd do something like this,
<img src="http://www.example.com/images.php?image.gif"> if you are like me and are unable to use a .htaccess file as well then it has another advantage in that you can prevent hotlinking with it.
you can sticky me for the script if you want, it's too long to put down here.