How to route EVERYTHING other than Web API to /index.html

后端 未结 6 491
春和景丽
春和景丽 2020-12-04 12:49

I\'ve been working on an AngularJS project, inside of ASP.NET MVC using Web API. It works great except when you try to go directly to an angular routed URL

6条回答
  •  旧时难觅i
    2020-12-04 13:39

    in my case none of these approaches worked. i was stuck in 2 error message hell. either this type of page is not served or some sort of 404.

    url rewrite worked:

    
        
          
            
              
    
              
                
                
                
              
              
            
          
        
        ...
    

    notice i matched on [a-zA-Z] because i don't want to rewrite any of the .js .map etc urls.

    this worked in VS out of hte box, but in IIS you may need to install a url-rewrite module https://www.iis.net/downloads/microsoft/url-rewrite

提交回复
热议问题