Share

how to route component open in iis Or windows hosting


100% working, just follow step as per mention here.

First, deploy a website in your local IIS like below step if it"s working fine then nothing can do in server.

Step 1: Open Web Platform Installer (“Web PI”) – if you don’t have this, you can download from here

https://www.microsoft.com/web/downloads/platform.aspx

Step 2: URL-rewrite download

https://www.iis.net/downloads/microsoft/url-rewrite

Step 3: using cmd  "ng build --prod" to build your angular project

Step 4: the same folder create one "web.config" file.

copy & paste below code in your web config file

<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular 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="./index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Step 5: enjoy :)

1