I tried:
services.AddMvc().AddRazorPagesOptions(options =>
{
options.Conventions.AddPageRoute("/Index", "old");
options.Conventions.AddPageRoute("/NewIndex", "");
}).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
This exception is thrown:
AmbiguousMatchException: The request matched multiple endpoints. Matches:
Page: /Index
Page: /NewIndex
I found this, that suggests renaming the Index page, but it obviously, if not a good reason presented, is a workaround. Can't I just change the default page without renaming the /Index page?
EDIT
The suggested SO threads don't cover the problem I explained, which is overriding the default route without having to rename the default Index
page.
The accepted answer solved the problem.