Last active
May 8, 2022 14:05
-
-
Save freshcutdevelopment/8df4ee8cb7470b3e18d3236931b46d97 to your computer and use it in GitHub Desktop.
Web.config for single page application push state in IIS (credit to Matt McCabe)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<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" /> | |
</conditions> | |
<action type="Rewrite" url="/" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you know how to ignore certain paths (for exemple the
static
folder) for the redirection ?EDIT : answered by https://www.mattburkedev.com/iis-rewrite-rule-for-single-page-apps/
I also had to change the rewrite url from
/
topath/to/my/application
.ie. my address is
http://server/platform/application
, so I wrote the following rewrite rule: