Monday, June 10, 2019

Publish Angular in Directory in IIS

Build Angular project:
ng build --prod --deployUrl="/App1/" --baseHref="/App1/"


Add web.config File:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
</system.web>
<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="/App1/index.html" />
      </rule>
    </rules>
  </rewrite>
        <directoryBrowse enabled="false" />
</system.webServer>
</configuration>

No comments:

Post a Comment