Speed Up My Website, Turn Off ETags

Speed Up My Website, Turn Off ETags

Posted by Rainey

Today a super fast way to speed up your site a little, disable the ETags. The ETags are used to determine whether a piece of content in the browsers cache matches what is on the server.

The problem with ETags is that they typically are constructed using attributes that make them unique to a specific server hosting a site. ETags won’t match when a browser gets the original component from one server and later tries to validate that component on a different server, a situation that is all too common on Web sites that use a cluster of servers to handle requests. By default, both Apache and IIS embed data in the ETag that dramatically reduces the odds of the validity test succeeding on web sites with multiple servers. – Yahoo Developer Network

For newer sites that I am building, I am moving toward multiple servers and CDNs.  So, this means I need to turn this feature off all together in my .htaccess file. If you are running your site on Apache like about 50% of the internet, this file in the root directory of your website.

HEADS UP: I have seen hosting providers with .htaccess files at lower levels than the directory and you don’t need to mess with those.  I have also seen providers where there is no .htaccess file.  In this case, you can create a blank text document, save it as .htaccess and use it to add your settings. You can easily test to see if hidden files are visible by create a blank .test file and uploading it to your server :-)

Ok, add the following to the .htaccess file:

# Configure ETags
FileETag none

Boom, that wraps it up! A tutorial with one line of code.  Please share any page speed tips that you may have in the comments below.

Like what you are reading? Subscribe to receive monthly tips & updates!

A Monthly Roundup of Articles and a Sweet Deal

Get the latest tips, tricks, tutorials and freebies in your inbox once a monthly.

Join our growing community of front-end web developers and designers. We are constantly publishing new industry tips, tricks and tutorials to help you take your game to the next level. We are also going to include a freebie or deal on something cool each month. Enter your email below and you will only receive this email once a month, nothing else.

Subscribe to our mailing list

* indicates required

Today in Web Design - hosting, Tutorials, WordPress