Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple IIS rewrite outbound rule is giving an error and page crashes

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

like image 837
Friend Avatar asked Jun 12 '15 14:06

Friend


People also ask

Where are IIS rewrite rules stored?

When done on the server level it is saved in the ApplicationHost. config file. You can also define it on the folder level, it that case it is saved in a web. config file inside that folder.

How does IIS URL Rewrite work?

The URL Rewrite module lets you translate search engine-friendly URLs into a format that your application currently uses. Also, it lets you create redirect rules that can be used to redirect search engine crawlers to clean URLs.


1 Answers

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>
like image 100
Shirish Avatar answered Oct 20 '22 01:10

Shirish