Ibrar Hussain
Ibrar Hussain

Reputation: 1811

Remove /index.aspx from resolved url

I'm trying to add an outbound rewrite rule that removed index.aspx from a resolved url on a website. See my below update for the rule I have in place. See second update as to my findings with regards to a simple rule not working.

In both scenarios I get a 500 error and can't see anything in Event Viewer to help narrow down the problem. We have inbound rules already that work fine so it's specifically an issue when I add an outbound rule.

UPDATE

I've been reading online and have tried with the following outbound rule but keep getting a 500 internal server error?

<outboundRules>
<rule name="Remove index.aspx" preCondition="IsHTML">
    <match pattern="(.*?)/?index\.aspx" />
    <action type="Rewrite" value="{R:1}/" />
</rule>
<preConditions>
    <preCondition name="IsHTML">
        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
    </preCondition>
</preConditions>
</outboundRules>

UPDATE 2

I've noticed that this isn't a problem with the syntax of my outbound rule as even putting in the simplest of rules through the IIS interface breaks the website (causing a 500 error):

<outboundRules>
<rule name="test">
    <match filterByTags="A" pattern="test.com" />
    <action type="Rewrite" value="blah" />
</rule>
</outboundRules>

The URL rewrite module is installed as we have inbound rules that work correctly. The version of IIS is 7 if that helps.

Upvotes: 1

Views: 608

Answers (1)

John Askew
John Askew

Reputation: 233

Are you using GZIP compression? This conflicts with outbound rewrite rules and could be the cause of the error.

See: http://forums.iis.net/t/1165899.aspx for some advice on how to combine outbound redirect rules with compression.

Upvotes: 2

Related Questions