Dipesh
Dipesh

Reputation: 371

IIS Rewrite rule for serverURL/Home/Index/2 URL type

I've implemented Angular 2 app with the routing, its working fine with the URL like serverURL/Home/Index its properly navigating to appropriate component without any errors.

But when I try entering serverURL/Home/Index/2 its giving me the following error Error I' getting when I enters above URL with <code>/{id}</code>

I've written below snippet in the web.config for Rewriting in IIS

<system.webServer>    
    <rewrite>
      <rules>
        <rule name="AngularJS" 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="src/" />
        </rule>        
      </rules>
    </rewrite>
  </system.webServer>

Even I've written { path: "Index/:id", component: IndexComponent }, in the routing file

Please help in this, thanks in advance.

Upvotes: 1

Views: 62

Answers (0)

Related Questions