MVC Core 6 (Apache, Ubuntu) Redirect from /, //, ///, etc to main Page

15 Views Asked by At

give me please advice how I can redirect from "example.com///", "example.com/////" or "example.com////////" to "example.com" because now all of these page give status 200 and it's not good at all. I have tried search but I couldn't find how I can fix it. I use MVC Core 6, Ubuntu, Apache on server.

I tried routing like: app.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}", defaults: new { controller = "Home", action = "Index" }); But it doesn't work and I can't redirect to main page.

I also tried to catch into debug mode from "/////" but breakpoint in this case doesn't work.

0

There are 0 best solutions below