一把umbraco 7单页应用程序路由 [英] Umbraco 7 single page application routing
问题描述
我有身边一把umbraco 7做了我的单页应用程序的问题。
我想重定向到AngularJS,而不是一把umbraco所有请求,为我增加了以下urlrewrite到UrlRewriting.config:
<添加名称=SPA
virtualUrl =^〜/(?![0-9] + /)([^ \\?] *?)$
rewriteUrlParameter =ExcludeFromClientQueryString
目标网址=〜/
IGNORECASE =真/>
但这种重定向到AngularJS所有响应,所以现在无法在/一把umbraco打开一把umbraco。有谁知道如何使重定向/除外一把umbraco到角都响应的urlrewrite?
我发现,解决办法是比它看起来更容易。经常想想前pressions始终就像是that.The常规EX pression说:从基本URL(〜)后字符串的开始排除一把umbraco和ucommerce和uCommerce,一部分划入基本URL <。 / p>
下面是我的解决方案:
&LT;添加名称=Eventcatering
virtualUrl =^〜/(?一把umbraco | ucommerce | uCommerce)(。*)
rewriteUrlParameter =ExcludeFromClientQueryString
目标网址=〜/
IGNORECASE =真/&GT;
我用的是uCommerce包为好,这在/ ucommerce一些控制API,所以这些都需要太排除在外。
I have a problem with my single page application made around Umbraco 7. I would like to redirect all requests to AngularJS instead of Umbraco, for that I have added the following urlrewrite to UrlRewriting.config:
<add name="SPA"
virtualUrl="^~/(?![0-9]+/)([^\?]*?)$"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/"
ignoreCase="true" />
But this redirects all responses to AngularJS, so now it not possible to open Umbraco at /umbraco. Does anyone know how to make a urlrewrite that redirects all responses to Angular except /umbraco?
I've found that the solution was easier than it looked. Think regular expressions always is like that.The regular expression says: "From the start of the string after the base Url (~) exclude umbraco and ucommerce and uCommerce, the rest goes to base url.
Here's my solution:
<add name="Eventcatering"
virtualUrl="^~/(?!umbraco|ucommerce|uCommerce)(.*)"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/"
ignoreCase="true" />
I use the uCommerce package as well, which have some control API in /ucommerce, so these need to be excluded too.
这篇关于一把umbraco 7单页应用程序路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!