11

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

NoWar
  • 36,338
  • 80
  • 323
  • 498
  • 2
    Check out the response on this post http://serverfault.com/questions/309713/outbound-url-rewrite-rule-causes-500-server-error-on-iis7-0/309733?noredirect=1#comment863220_309733. Compression is a common cause of issues for outbound rules. Try turning dynamic compression off to confirm. – Scott Forsyth Jun 12 '15 at 21:30
  • 1
    Check this link, i think you will get a response http://forums.iis.net/t/1165899.aspx – Kassav' Jun 15 '15 at 14:42
  • @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 Jun 15 '15 at 17:36
  • Did the rewrite using default regex is working? – Kassav' Jun 15 '15 at 18:44
  • there is a web.config file in `%SystemDrive%\inetput\wwwroot\` please add its contents to your post – Dave Alperovich Jun 15 '15 at 20:00
  • @Kassav' FOr this site nothing is working at all. Even if I do `` for example. – NoWar Jun 16 '15 at 00:55
  • @DaveAlperovich Thanks for the input but at this place there is no any web.config. – NoWar Jun 16 '15 at 01:20
  • this is odd. have you checked? after configuring with IIS, a web.config should be generated – Dave Alperovich Jun 16 '15 at 01:22
  • @DaveAlperovich Welll... It is an arvixevps.com hosting and there is no web.config at this place... – NoWar Jun 16 '15 at 01:34
  • IIS always uses config files. The GUI is just a graphic wrapper over it. The web.config you used for disabling compression is not a .NET or Visual Studio config, it is an IIS config. IIS config files have the `system.webServer` marking... – Dave Alperovich Jun 16 '15 at 01:44
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/80616/discussion-between-dave-alperovich-and-dimi). – Dave Alperovich Jun 16 '15 at 01:47
  • @Dimi Hi have you Checked the IIS logs? and it should show show that it’s a 500.50 error in this case.I'm no expert but this post might help http://weblogs.asp.net/owscott/500-50-error-using-url-rewrite – Heisenberg Jun 19 '15 at 12:07
  • 1
    `500.52` means you are still compressing. I'll leave you with that as I have "no any solution" – Dave Alperovich Jun 21 '15 at 17:44

1 Answers1

3

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>
InteXX
  • 6,135
  • 6
  • 43
  • 80
Shirish
  • 1,252
  • 11
  • 20