Configure IIS server to work with Aurelia framework and push state

后端 未结 1 642
隐瞒了意图╮
隐瞒了意图╮ 2020-12-20 14:01

I have created a basic aurelia app starting from this repo and I was trying to get rid of the # (hashtag) in the URL bar.

I have 2 projects, one running WebApi on a

相关标签:
1条回答
  • 2020-12-20 14:55

    I'm using the Azure which needed a web.config to handle non hash routing correctly, it just redirects all routes into the index.html which contains the aurelia app. Without it (or a similar technique) it was giving 404s.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <system.webServer>
         <rewrite>
                 <rules>
                     <remove name="redirect all requests" />
                     <rule name="redirect all requests" stopProcessing="true">
                         <match url="^(.*)$" ignoreCase="false" />
                         <conditions logicalGrouping="MatchAll">
                             <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
                         </conditions>
                         <action type="Rewrite" url="index.html" appendQueryString="true" />
                     </rule>
                 </rules>
             </rewrite>
        </system.webServer>
    </configuration>
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题