Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Web.config for single page application push state in IIS (credit to Matt McCabe)
<?xml version="1.0" encoding="utf-8" ?>
<remove name="pushState" />
<rule name="pushState" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<action type="Rewrite" url="/" />

This comment has been minimized.

Copy link

@tsauvajon tsauvajon commented Aug 1, 2018

Do you know how to ignore certain paths (for exemple the static folder) for the redirection ?

EDIT : answered by

<add input="{REQUEST_URI}" pattern="(static)" negate="true" />

I also had to change the rewrite url from / to path/to/my/application.
ie. my address is http://server/platform/application, so I wrote the following rewrite rule:

<action type="Rewrite" url="/platform/application" />

This comment has been minimized.

Copy link

@mataprasad mataprasad commented Jun 22, 2020

Thanks worked like charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment