11
votes

I try to use IIS rewrite outbound rules at the IIS where some of website have it implemented successfully.

So I created a simple rule to replace the word "test" with "123456".

And I am getting this error

500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.

Web.config

<system.webServer>  
        <!--<urlCompression dynamicCompressionBeforeCache="false" />     -->
        <urlCompression doStaticCompression="false" doDynamicCompression="true" dynamicCompressionBeforeCache="false" />

It seems like if I add any (just ANY) oubound rule the website craches. I mean that the pattern of the rule doesnt have impact but the rule itself liek an entry.

Any clue?

P.S. Should I install URL Rewrite Module 2.0 coz it seems like I have installed the old version... Will it solve the issue?

enter image description here

enter image description here

P.S. I did some extra changes but it doesn't work at all.

  1. I use

< urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" / >

  1. I installed this fix rewrite_2.0_rtw_x64_KB2749660.msp (https://support.microsoft.com/en-us/kb/2749660 "FIX: Response is corrupted when you configure an outgoing rule in URL Rewrite Module 2.0 for IIS 7.0 or IIS 7.5")

I have asked about this issue here as well https://forums.iis.net/t/1226401.aspx?Outbound+rule+is+giving+500+error+for+the+entire+website

1
Check out the response on this post serverfault.com/questions/309713/…. Compression is a common cause of issues for outbound rules. Try turning dynamic compression off to confirm.Scott Forsyth
Check this link, i think you will get a response forums.iis.net/t/1165899.aspxKassav'
@Kassav' I have investigated thislink a few days ago. It doesnt help. Imagine I disable ANY compression and when I enable ANY rule the entire website is not working even if I try to open empty *.html page.NoWar
Did the rewrite using default regex is working?Kassav'
500.52 means you are still compressing. I'll leave you with that as I have "no any solution"Dave Alperovich

1 Answers

3
votes

For outboundRules use like below details..

  1. On the machine running the web site, from the command line run:

    reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0

    You may need to follow this up with an iisreset

  2. Add the following to the top of your system.webServer section of your web.config file to disable the unsupported static compression while leaving dynamic unharmed;

<urlCompression doStaticCompression="false" doDynamicCompression="true" dynamicCompressionBeforeCache="false" />
  1. The final step, is probably not needed- but! Open up your IIS management console- Click on the top level item, from the IIS segment open the “Modules” component. From within here on the right hand side bar, click “View ordered List…” and make sure RewriteModule appears in the list BELOW the DynamicCompressionModule. For Reference you can see here - http://codeblog.shawson.co.uk/iis7-urlrewrite-outbound-links-with-compression-enabled/

<rewrite>
  <rules>
    <rule name="InboundFriendlyAboutUs" stopProcessing="true">
      <match url="^about-our-car-finance$" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="page.aspx" />
    </rule>
  </rules>
  <outboundRules>
    <rule name="Outbound1" preCondition="IsHtml">
      <match filterByTags="A, Form" pattern="^(.*)About-Us\.aspx$"/>
      <action type="Rewrite" value="{R:1}about-our-car-finance"/>
    </rule>
    <preConditions>
      <preCondition name="IsHtml">
        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html"/>
      </preCondition>
    </preConditions>
  </outboundRules>
</rewrite>