Skip to content

Instantly share code, notes, and snippets.

@joe-oli
Created September 16, 2019 02:14
Show Gist options
  • Save joe-oli/daf69ffbe763a404c927b7e3c160d5d7 to your computer and use it in GitHub Desktop.
Save joe-oli/daf69ffbe763a404c927b7e3c160d5d7 to your computer and use it in GitHub Desktop.
IIS react web.config to redirect a not found 404 route to index.html
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<remove value="default.aspx" />
<remove value="iisstart.htm" />
<remove value="index.htm" />
<remove value="Default.asp" />
<remove value="Default.htm" />
</files>
</defaultDocument>
<staticContent>
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/YourVirtualReactUIApp/index.html" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment