Documentation
Kentico ImageEngine Integration
Sign up for an ImageEngine account in order to get a Delivery Address for your optimized images.
Below, we assume that images.mysite.com
is your delivery address and that it is correctly set up in the DNS. You can of course use a delivery address on the shared imgeng.in
domain name too.
In your web.config file within <system.webServer>
add the following:
<rewrite>
<outboundRules>
<rule name="Rewrite Media to CDN" preCondition="IsHTML">
<match filterByTags="Img" pattern="/getmedia/(.*)" />
<action type="Rewrite" value="https://images.mysite.com/getmedia/{R:1}" />
</rule>
<rule name="Rewrite Media Files to CDN by path" preCondition="IsHTML">
<match filterByTags="Img" pattern="/media/(.*)" />
<action type="Rewrite" value="https://images.mysite.com/media/{R:1}"/>
</rule>
</outboundRules>
</rewrite>
Make sure to change
images.mysite.com
in both places in the code above
For more information on IIS rewrites and configuration examples, see the IIS Rewrite module documentation.
# CSS Background Images
If you are using background images 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, but they do not always support the latest version of Kentico:
- Laughlin Kentico CDN Rewrite 1.0 supports up to Kentico version 8.2
- Kentico CDN Injector module supports up to Kentico 6.0