Install this extension: https://www.iis.net/downloads/microsoft/url-rewrite
And add this to web.config under system.webServer
<rewrite> <rules> <clear /> <rule name="Html5Mode" enabled="true" stopProcessing="true"> <match url="^(.+)$" negate="true" /> <conditions> <add input="{REQUEST_URL}" pattern="^(.+)$" negate="true" /> </conditions> <action type="Rewrite" url="/index.html" logRewrittenUrl="true"/> </rule> <rule name="AngularJS" enabled="true" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" /> </conditions> <action type="Rewrite" url="/index.html" /> </rule> </rules> </rewrite>
Here is the full web.config including serving static files.
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <clear /> <rule name="Html5Mode" enabled="true" stopProcessing="true"> <match url="^(.+)$" negate="true" /> <conditions> <add input="{REQUEST_URL}" pattern="^(.+)$" negate="true" /> </conditions> <action type="Rewrite" url="/index.html" logRewrittenUrl="true"/> </rule> <rule name="AngularJS" enabled="true" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" /> </conditions> <action type="Rewrite" url="/index.html" /> </rule> </rules> </rewrite> <handlers> <clear /> <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" /> </handlers> <staticContent> <mimeMap fileExtension=".*" mimeType="application/octet-stream" /> </staticContent> </system.webServer> </configuration>