Page 1 of 1

ETag & Last-modified headers in dymanic pages

Posted: Sun Mar 09, 2008 6:14 am
by yurik
All my site's pages are parsed by PHP. This means that none of these headers are generated by default.

My pages have currency amounts which do not necessarily change every day. Currency rates change every day but my currency amounts may not change every day.

Example:
2500 yens = 24.35USD @ 102.69 yens/usd (My site would show $24 because I round the result)
2500 yens = 24.26USD @ 103.05 yens/usd (My site would show $24 because I round the result)

So this means that my site's dollars would only change when there is at least a $1 change in exchange rate.

Is there any way to make ETags and Last-modified tags ? Are they really necessary for SEO positioning?

Re: ETag & Last-modified headers in dymanic pages

Posted: Sun Mar 09, 2008 6:19 am
by Chris Corbyn
I'm not sure about search engines but there intended purpose is to save bandwidth by not serving the same content twice.

The E-Tag can be anything which uniquely identifies a revision of the data. Ideally it would be something like a MD5 but realistically that's a bit wasteful and expensive. It's probably best to just serve the E-Tag as the Last-Modified time formatted a little differently. It would be a weak E-Tag but for the purpose of what you're doing it should work.

If you know the exchange rate only changes daily, just serve new E-Tags and Last-Modified times once per day.

Re: ETag & Last-modified headers in dymanic pages

Posted: Sun Mar 09, 2008 6:50 am
by yurik
Ok, but as in my example, the exchange rate may not vary enough so as to change the dollar amount I use in my site. So the dollar amount will not change every day.

Re: ETag & Last-modified headers in dymanic pages

Posted: Sun Mar 09, 2008 7:19 am
by Chris Corbyn
So track it in a database. If it's changed enough, then send new last-modified and e-tag headers :) Provided you always know what the previous exchange rate was then this should be fine. Does you code currently know how much it has changed?

Re: ETag & Last-modified headers in dynamic pages

Posted: Sun Mar 09, 2008 1:51 pm
by yurik
That's a good idea, thanks! :wink: