tags:

views:

61

answers:

1

I generate htm files dynamically using php and .htaccess. I read somewhere that I should remove Etags for files of type text/html? Is that correct? I am wondering if I use etags and If i don't change the content, I could save some bandwidth. I would appreciate if you guys could tell me if I can use etags for htm files.

A: 

As far as i know the Etag is an http header is generated by the HTTP server used by the cache system.

The idea:

  • You ask to stackoverflow.com the image logo.png
  • stackoverflow.com will answer to you with a HTTP 304 (content not modified, etag: XXXXXX)
  • Your browser before ask the image again will check the cache for a resource called: logo.png, from the website: stackoverflow, with the etag: XXXXXXX
  • If the browser find it, it will load the image from the cache, without downloading
  • If it can't find it, it will ask again to the web server to download it.

so... for what propose you want use the ETags ?

If you want understand more about the ETags could be interesting download HttpFox for firefox.

Apache have his own cache system and it's used when you download or require any "static" download, like html files and images.

If you want do it on dynamic context you must implement it by yourself.

Cesar