Kentico Integration

In your web.config file within <system.webServer> add the following:

        <rule name="Rewrite Media to CDN" preCondition="IsHTML">
            <match filterByTags="Img" pattern="/getmedia/(.*)" />
            <action type="Rewrite" value="{R:1}" />
        <rule name="Rewrite Media Files to CDN by path" preCondition="IsHTML">
            <match filterByTags="Img" pattern="/media/(.*)" />
            <action type="Rewrite" value="{R:1}"/>

Here is a link to the IIS Rewrite module documentation for more information on configuration:

Images as Background

If you are using images as a background in your CSS, you will need to use the absolute path with the CNAME domain in order for it to properly optimize.

There are also plugins in the marketplace that enable this functionality as well, but they do not always support the latest version of Kentico:

  • Laughlin Kentico CDN Rewrite 1.0, which works up to Kentico version 8.2:
  • Kentico CDN Injector module, which works up to Kentico 6.0: