We have to make IIS fall back to index.html by adding a rewrite rule.
Step 1: Install IIS URL Rewrite Module
Step 2: Add a rewrite rule to web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="AngularJS Routes" 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>
STEP 3: add web.config link to angular.json: (because after ng build it will skipped)
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.