Shahzad Shahzad - 4 months ago 45x
AngularJS Question

AngularJS SPA within Umbraco

I have an Umbraco 6.4 website, under which I am now trying to put an AngularJS 2 SPA.




My problem is with the routing that is done by Umbraco. Since Umbraco handles all of the routing up to the root level, when the Angular app gets refreshed:
I get a
404 - Not Found

I have added a URL rewrite in the
, however I have done it in a way that the destination url is always the

<add name="myapp" virtualUrl="^~/myapp/*" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/myapp/index.html" ignoreCase="true" />

What I would like to be able to do is define a rewrite which lets me override the Umbraco routing whenever the path begins with

I have read this blog post, but it doesn't really relate to my problem because the way I have built my SPA, it doesn't have anything to do with Umbraco. Also, I must have Umbraco as the root directory, and therefore I cannot rely on IIS to do this for me either.

It would be great if someone, anyone, could point me in the direction. Thanks


For anyone else who may have a similar issue:

I able to work around this problem by adding a web.config to the /appname directory and added the following configuration.

<?xml version="1.0" encoding="UTF-8"?>
            <rule name="ruleName" stopProcessing="true">
               <match url=".*" />
               <conditions logicalGrouping="MatchAll">
                  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
               <action type="Rewrite" url="/myapp/" />
      <defaultDocument enabled="true">
            <clear />
            <add value="index.html" />