Angular Routing in Windows Shared Hosting

In Windows Shared hosting we have to create “web.config” file to support Angular routing. The file content would be similar to this –

<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="/" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
  <system.web>
    <compilation tempDirectory="X:\INETPUB\VHOSTS\<HOST_NAME>\tmp" />
  </system.web>
</configuration>

You have to get the actual path of tempDirectory from your server and have to change it accordingly –

“<compilation tempDirectory=”X:\INETPUB\VHOSTS\<HOST_NAME>\tmp” />”

After creating/ updating this file please make sure you restart your IIS server or similar action need to perform from your shared hosting server.

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *