How to disable mod_pagespeed from your .htaccess file

PageSpeed mod_pagespeed is a module for Apache server which is just like a plugin, and since Apache is different from IIS, it cannot be installed on IIS servers.

As for what it does, it does multiple things:

  • Minifies (removes whitespace, comments, etc) or in other words compresses external CSS and JavaScript
  • In addition to minifying JS, it combines multiple external JS files into one JS file which causes less http requests or round trips so the page loads faster
  • Optimizes the cache for the files. Every http header has a cache information, or in other words, for how long should the browser keep the resource, mod_pagespeed optimizes this number
  • Uses the idea of URL fingerprinting for the new JS files. Basically when the mod_pagespeed optimizes and combines multiple JS files into one file, this temporary file is stored somewhere on the server, however, its filename is generated from the content of the JS files using checksum algorithms such as MD5. What this allows to do is that mod_pagespeed tells the browser to store the JS file for a long time (sets a long cache time), however as soon, as the developer will change the content even in one of the JS files, since the checksum of all the files will change, mod_pagespeed will generate a new temp JS file which will have a different URL compared to the old one. So, when the user who has saved the old combined JS file will try to reload the page, since the URL of the new JS file will be new, it will force the browser to download it again. So essentially this is one way to do cache control.
  • Minifies HTML

One downside however is that it uses much more CPU resources on the servers.

Another downside is that it’s incorrectly optimising the css and also constantly caching so testing updates is painful.

 

To disable it,  you need to add this lines in your .htaccess file:

<IfModule pagespeed_module>
ModPagespeed off
</IfModule>

This will do the trick and disable mod_pagespeed for your hosting account.

 

HOW TO CREATE A .HTACCESS FILE

 

 

Comments

comments

Leave a Reply

Your email address will not be published. Required fields are marked *