Reputation: 14586
Using the following rule, I can successfully rewrite urls to redirect to app/index.cshtml. Som resources like images, css and javascripts should not be redirected, so I've used conditions:
<rule name="AngularJS">
<match url="(.*)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{URL}" negate="true" pattern="\.png$" />
<add input="{URL}" negate="true" pattern="\.css$" />>
<add input="{URL}" negate="true" pattern="\.js$" />
</conditions>
<action type="Rewrite" url="app/index.cshtml" />
</rule>
But as soon as I start using minified content, the requested URL becomes similar to :
/myapp/bundles/utilities?v=EH9YuZDBt_fj7iqRP2QA8lCkJ59wjV6woELIwvR7irk1
How do I prevent that type of url to be redirected ?
Upvotes: 5
Views: 3666
Reputation: 133403
You can create a ignore rule, match URLs to ignore
<rule name="Ignore" enabled="true" stopProcessing="true">
<match url="^(images|css|bundles).*"/>
<conditions logicalGrouping="MatchAll" trackAllCaptures="false"/>
<action type="None"/>
</rule>
Upvotes: 7