Site structure
Version 6.x > Site structure > Use IIS7 URL Rewrite Module outbound rules with Kentico 6 View modes: 
User avatar
Member
Member
mmacarie - 11/18/2013 7:46:07 AM
   
Use IIS7 URL Rewrite Module outbound rules with Kentico 6
Hello,

I'm having the following problem:
I want to expose CMSAdminControls folder as CMSUIControl.
I am trying to use IIS7 URL Rewrite Module and I have defined the following inbound and outbound rules:
    <rewrite>
<rules>
<rule name="Inbound CMSUIControls" stopProcessing="true">
<match url="CMSUIControls/(.*)" />
<action type="Rewrite" url="CMSAdminControls/{R:1}" logRewrittenUrl="true" />
</rule>
<rule name="Inbound CMSUIControls QueryString" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{REQUEST_URI}" pattern="(.*)CMSUIControls(.*)" />
</conditions>
<action type="Rewrite" url="{C:1}CMSAdminControls{C:2}" appendQueryString="false" />
</rule>
</rules>
<outboundRules>
<rule name="Outbound CMSUIControls" preCondition="IsHTML" enabled="true">
<match filterByTags="Img, Link, Script" pattern="(.*)CMSAdminControls(.*)" />
<conditions trackAllCaptures="true">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</conditions>
<action type="Rewrite" value="{R:1}CMSUIControls{R:2}" />
</rule>
<preConditions>
<preCondition name="IsHTML">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>

The inbound rules are working ok but when I enable the outbound rule the URL Rewrite Module crashes on each request with 500 URL Rewrite Module error. I have enabled tracing and it returns the following error description "Outbound rewrite rules cannot be applied when the content of the HTTP response is encoded ("deflate"). "
However the compression is disabled at server level.

Am I missing something? Is there another better way to do this?

User avatar
Member
Member
mmacarie - 11/19/2013 6:28:10 AM
   
RE:Use IIS7 URL Rewrite Module outbound rules with Kentico 6
I've got it to work by using the solution provided here: http://codeblog.shawson.co.uk/iis7-urlrewrite-outbound-links-with-compression-enabled/

As an aditional step the resource compression must be disabled in Kentico for this to work.