Skip to content

Commit d08f08b

Browse files
authored
Update Program.cs
Regex used to match all urls, whether or not it has an extension
1 parent 24e8831 commit d08f08b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

projects/rewrite/rewrite-2/src/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public void Configure(IApplicationBuilder app)
1414
app.UseRouting();
1515

1616
var options = new RewriteOptions()
17-
.AddRedirect("([/_0-9a-z-]+)+(.*)$", "/?path=$1&ext=$2"); //redirect any path that ends with .html
17+
.AddRedirect("([/_0-9a-zA-Z-]+)\\.([^/]+)$", "/?path=$1&ext=$2"); //redirect any path that ends with .html
1818

1919
app.UseRewriter(options);
2020

@@ -49,4 +49,4 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
4949
webBuilder.UseStartup<Startup>()
5050
);
5151
}
52-
}
52+
}

0 commit comments

Comments
 (0)