In .Net Core web API I want the endpoints to work with both ways like : /api/order or /order
So I tried so many regex patterns for rewriting the url to except "api" but no luck yet. In startup Configure :
var rewrite = new RewriteOptions()
.AddRewrite("^(?!api\\/).*$", "/api/$1", true)
.AddRedirectToHttps();
app.UseRewriter(rewrite);
I believe my approach could be wrong about this.
Order Controller:
[Route("api/[controller]")]
[ApiController]
public class OrderController : ControllerBase
{