12

One of my friend says, etags on off mode for speed up page loading. How to off etags with htaccess?

BrianC
  • 10,591
  • 2
  • 30
  • 50
Joshua
  • 419
  • 3
  • 7
  • 19

2 Answers2

9

To unset Etags use 3 lines below:

Header unset Pragma
FileETag None
Header unset ETag 

But, to increase page loading speed, my advice is YSlow. perfect tool & Yslow recommends to use Etags instead of setting off.

Adam Hopkinson
  • 28,281
  • 7
  • 65
  • 99
risyasin
  • 1,325
  • 14
  • 24
  • I put these both at .htaccess and apache conf, and etag still exists after restarting apache 2.2 – john Oct 14 '11 at 05:14
  • @John. Did you check your server configuration to allow you to change Headers in htaccess or AllowOverride setting is on ? – risyasin Oct 28 '11 at 15:53
  • 4
    I believe YSlow actually recommends not having ETags on if your site has more than one server. – Alex W Mar 11 '13 at 13:26
  • Alex W.'s note is totally right. i didn't know that. thank you. http://developer.yahoo.com/performance/rules.html#etags – risyasin Apr 24 '13 at 14:58
  • 1
    Also keep in mind ETags can be used to track users; and many users don't want the risk. – jww Nov 06 '16 at 01:43
5

Putting the following in your .htaccess should do the trick.

Header unset ETag
FileETag None

Note: Disabling etags only helps if you are hosting the same content from more than 1 server (such as when using a cluster or CDN). Take a look at wikipedia or yahoo best practices for more information.

syserr0r
  • 654
  • 6
  • 17
  • Also keep in mind ETags can be used to track users; and many users don't want the risk. – jww Nov 06 '16 at 01:43