How do I configure IIS for URL Rewriting an AngularJS application in HTML5 mode?

后端 未结 7 2193
春和景丽
春和景丽 2020-11-22 12:12

I have the AngularJS seed project and I\'ve added

$locationProvider.html5Mode(true).hashPrefix(\'!\');

to the app.js file. I want to confi

7条回答
  •  失恋的感觉
    2020-11-22 12:15

    I write out a rule in web.config after $locationProvider.html5Mode(true) is set in app.js.

    Hope, helps someone out.

      
        
          
            
              
              
                
                
                
              
              
            
          
        
      
    

    In my index.html I added this to

    
    

    Don't forget to install IIS URL Rewrite on server.

    Also if you use Web API and IIS, this will work if your API is at www.yourdomain.com/api because of the third input (third line of condition).

提交回复
热议问题