Take the 2-minute tour ×

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.

share|improve this question
add comment

2 Answers

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.

share|improve this answer
add comment

Etags can be usefull speeding up your website, even with dynamic content (like php scripts). Especially on mobile connections this is important, since connection speed is slower. I use ETag headers on some mobile websites like this:


Hint: You must not include curent time or other often changing content in the page, because this prevents it from beeing cached by the client (the browser).

share|improve this answer
add comment

Your Answer


