Click here to Skip to main content
12,816,100 members (31,131 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 18 Sep 2013

Optimize WordPress Speed Hosted on IIS

, 18 Sep 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
How to optimize WordPress speed hosted on IIS

If you’re interested in getting a high score in ySlow or PageSpeed for your blog and your blog happens to be hosted on IIS of Windows Server, here are some tips:

1. Enable gzip

  1. To enable gzip on IIS, first add Dynamic Content Compression Role Services for IIS.


  2. If your site is running with Application Pool Identity account, you need to grant IIS apppool\[your application pool name] user full control access to the folder %SystemDrive%\inetpub\temp\IIS Temporary Compressed Files. This is the default temp folder which is used by IIS for content compression. Double click the following icon to see which is the default folder for compression in your situation.


  3. In your site’s Web.Config file, under system.webServer element, add the following configuration:
        <httpCompression directory="
    %SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
          <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="*/*" enabled="false" />
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        <urlCompression doStaticCompression="true" doDynamicCompression="true" />
  4. Check with Firebug or Chrome developer tools if there’s Content-Encoding is gzip in the header of your site’s HTTP response:


2. Combine JavaScript File

For example, your site has a list of JavaScript files, you can:

  1. Combine them into one single file by the following command:
    copy /b *.js source.js
  2. If you’re using SublimeText, install the Sublime-Minifier plugin, hit ctrl+alt+shift+m, compress the source.js to source.min.js.
  3. Replace the JavaScript files with the compressed file.

3. Add Expiration for Static Files

  1. In your site’s Web.Config file, again, under system.webServer element, add:
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="3.00:00:00" 
      cacheControlCustom="public" />
  2. If you have a favicon, under configuration element, add:
    <location path="favicon.ico">
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" 
        cacheControlCustom="public" />

You can adjust the time according to your situation.

4. Add *.css File in Header and *.js Files on the Bottom of the Page

I use Add to Header and Add to Footer plugin to insert CSS files and JS files. Place your CSS files to header and JavaScript files to footer.

After the steps above, your site probably will have a better score in ySlow and PageSpeed. Happy blogging! Smile


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

JIN Weijie
Software Developer (Senior) Honeywell
China China
ASTreeView, the best FREE treeview control for ASP.NET.

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170308.1 | Last Updated 18 Sep 2013
Article Copyright 2013 by JIN Weijie
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid