EllisLab text mark
Advanced Search
Trying to set far future expires headers on css files…
Posted: 10 June 2008 12:53 PM
Joined: 2008-01-23
109 posts

Moderator’s note: Moved to Howto.


As the post title hopefully suggests I’m trying (and failing) to set future expires headers on my EE-outputted CSS files.

By default EE seems to want to serve my CSS files with expires headers of 7/26/1997, resulting in 3 extra HTML requests for every page load.  Boo!

So the obvious/simplest way to do this seemed to be to set the headers using PHP in each of my 3 CSS files and then cache the output of those files (to mitigate the extra overhead of having php enabled in these templates). Alas I’m clearly doing something wrong, as it ain’t working.

My php looks like this, and lives at the very top of my template files:

('Expires: Thu, 15 Apr 2015 20:00:00 GMT');

PHP is set to allowed and parse on output, in my template preferences.  I’ve confirmed PHP as allowed via a simple echo, however my headers are not being set.

I’d prefer not to post a URL here but will happily PM it to any one who thinks they can help.

Any help or suggestions would be very gratefully received.


Posted: 10 June 2008 04:13 PM   [ # 1 ]   [ Rating: 0 ]
Joined: 2004-05-15
29075 posts

Whenever I experimented with headers I found it necessary to add “exit();” after the actual statement. You could try that.

Posted: 11 June 2008 04:28 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2008-01-23
109 posts

Thanks Ingmar, I’ll give that a try