IIS configuration for using angular ui routing html5Mode

强颜欢笑 提交于 2019-12-21 22:10:11

问题


Im using angular ui-routing but for the most encountered problem reason I want to ask something. Because of using '#' hashtag I prefered html5Mode property. But server side conf. is needed.(https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode) I m using IIS and I put the :

 <rewrite>
  <rules>
    <rule name="AngularJS Routes" stopProcessing="true">
      <match url=".*" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
      </conditions>
      <action type="Rewrite" url="/" />
    </rule>
  </rules>
</rewrite>

and install one tool which is mentioned another topic on stackoverflow (How do I configure IIS for URL Rewriting an AngularJS application in HTML5 mode?). But now I m getting : HTTP Error 403.18 - Forbidden The specified request cannot be processed in the application pool that is configured for this resource on the Web server.I m really spend my most of time for hashtag problem :( Please help me . What is the missing?


回答1:


<match url=(.*)>
..
..
..
<action type=“Rewrite” url=“/{R:0}”>

Change these two lines and try as the rewrite should be backward resource compatible



来源:https://stackoverflow.com/questions/32184300/iis-configuration-for-using-angular-ui-routing-html5mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!