TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-29-2008, 12:08 AM   #1 (permalink)
The Acquainted
 
buildakicker's Avatar
 
Join Date: Jan 2008
Posts: 119
Thanks: 21
buildakicker is on a distinguished road
Terminal Using Expire Header to cache images

Hi all!
I am trying to find some info on this. Is this something I should be doing? I have been reading about it, but am not to sure how to implement it.

Thanks!
__________________
SkiLeases.com
buildakicker is offline  
Reply With Quote
Old 02-29-2008, 12:25 AM   #2 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

Hiya,

I'm afraid that I am not entirely sure what you are trying to do. Can you post some links or a code sample?

Thanks,
Al.
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
The Following User Says Thank You to Alan @ CIT For This Useful Post:
buildakicker (02-29-2008)
Old 02-29-2008, 12:33 AM   #3 (permalink)
The Acquainted
 
buildakicker's Avatar
 
Join Date: Jan 2008
Posts: 119
Thanks: 21
buildakicker is on a distinguished road
Default

Hi Alan@CIT,

thanks for the reply... I was reading about Expired Headers and speeding up the load time with my site... I don't quite understand it. So I thought I would ask.

I have done this in my .htaccess file:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/png A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/css A2592000
</IfModule>

...but thought I could do that with PHP Headers() somehow. Is that true?
__________________
SkiLeases.com
buildakicker is offline  
Reply With Quote
Old 02-29-2008, 12:48 AM   #4 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

Hmm.. that's a good question. I would assume that you can but have no idea how. I'd like to know myself though so if anyone does know, come post!

Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
Old 02-29-2008, 02:05 AM   #5 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

The Expires header is one that you should be using (and probably are without knowing it) for anything which isn't 100% dynamic content. It's just another normal header (like Content-Type, Location, etc.). The purpose is simply to tell the client (browser) that after the expiry time, it must ask the server for a fresh copy of the item. The value of the header must be a date like Fri, 29 Feb 2008 01:52:00 GMT.

If the server doesn't send an Expires header, or one which is really short, then your browser will keep asking to see if it needs to re-download the content (or worse, cache the content however long it feels like) whenever you try to view the page/image/whatever. If the server says, for image.jpg, "Hey this image expires in a week" and you view the image 100 times a day (it's a photo of your new pet, or something) that's lots less downloads than if your browser just grabbed the file every time.

Other helpful headers to look into are Last-Modified and If-Modified-Since, for a start, which can further help with caching (and reducing time and effort travelling to and from the server) in a more flexible way than Expires.

P.S. I'm sure there was an article or two somewhere recently about this, aimed at using these headers specifically with PHP, but I can't remember where it was.
Salathe is offline  
Reply With Quote
The Following 2 Users Say Thank You to Salathe For This Useful Post:
Alan @ CIT (02-29-2008), Runar (11-07-2008)
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:43 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design