我有以下情况:
routes.MapRoute(
name: "Default",
url: "{countrycode}/{languagecode}/{controller}/{action}/{id}",
defaults: new { controller = "SignIn", action = "Index", id = UrlParameter.Optional, countrycode = "us", languagecode = "en" }
);
传入请求具有网址格式:
https://example.com/[countrycode]/[languagecode]
现在我还想支持一个子目录,该目录应该与请求root时的行为类似,例如:
https://example.com/subdir/[countrycode]/[languagecode]
- >应该去 - > https://example.com/[countrycode]/[languagecode]
同样适用于通过子目录请求的控制器和操作,例如:
https://example.com/subdir/[countrycode]/[languagecode]/signup/index
- >应该去 - > https://example.com/[countrycode]/[languagecode]/signup/index
这可以通过MVC路由,还是应该使用URL重写?