app.UseRewriter(new RewriteOptions().AddRedirect("login", "login.html")); //works
app.UseRewriter(new RewriteOptions().AddRewrite("login", "login.html", false)); //doesnt work
在第二种情况下,我收到错误 404,找不到页面。为什么? 该文件位于 wwwroot 目录中。
请务必在
app.UseRewriter
之前致电app.UseStaticFiles()
:
app.UseRewriter(new RewriteOptions().AddRewrite("login", "login.html", false));
app.UseStaticFiles();