Wednesday, 10 June 2009

Turn on IIS 6 Compression for CSS and Javascript

  1. Enable HTTP Compression
    1. Open IIS Manager
    2. Right-click "Web Site" and select "Services" tab.
    3. Check "Compress Static Files"
    4. Click "Okay"

  2. Specify that "js" and "css" file should be compressed by changing the metabase. By default, IIS 6.0 is set up to compress htm, html, and txt files.
    1. Open a command prompt
    2. cd to C:\Inetpub\AdminScripts (assuming the default location)
    3. run this command (you can change the list of extensions, but only specify static, compressible files here):
      cscript.exe adsutil.vbs set w3svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "txt" "js" "css"

  3. Restart the World Wide Web Publishing Service

No comments: