Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

ASP.NET Core MVC Rewrite and Default document

$
0
0

I'm trying to set Core MVC Rewrite so:

  • when
    localhost/part
    is requested, it responds with the default
    localhost/part/index.html
  • when
    localhost/part/[anything]
    , then still responds with
    index.html
    (
    localhost/part/index.html
    )

Here's what I have now:

app.UseRewriter(new RewriteOptions().AddRewrite("part(\\/.*)?", "part/index.html", true));

app.UseDefaultFiles();
app.UseStaticFiles();
app.UseIdentity();
app.UseMvc(...);

So now, when

localhost/part/[anything]/[something]
is requested, it does serve
index.html
. But it serves it as
localhost/part/[anything]/[something]/index.html
and this is a problem with Angular's BASE_HREF. So app showsLoading... and nothing else is loaded obviously. Hm... This requires a fix from Angular's part. And I have no idea for the fix right now. Anyone?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>