1
我一直在試圖解決這個問題,現在幾天沒有成功。 的情況下我已經重寫老網絡形式的網站MVC 3,並有一堆舊有網址的:需要被重定向到新的URL s:■Mvc 3重定向路線行爲怪異
這是兩條路線看起來像在Global.asax中應該趕上舊網址的所有請求:■
routes.MapRoute(
"legacyevents",
"events/{*slug}",
new { controller = "Redirect", action = "RedirectLegacyRoute" },
new[] { "Web.Controllers" }
);
routes.MapRoute(
"legacyarticles",
"articles/{*slug}",
new { controller = "Redirect", action = "RedirectLegacyRoute" },
new[] { "Web.Controllers" }
);
奇怪的是現在,當一個請求是這樣的
events/randomevent__12.aspx
一切正常,但如果在事件E是大寫活動/ randomevent__12.aspx asp.net som ewhere增加了一個事件字的URL,所以它看起來像這樣,當它擊中RedirectController
events/events/randomevent__12.aspx
由於缺乏關於SEO的知識時,我寫的網頁窗體應用程序幾年前,很多導入鏈接到舊網址有混合外殼:(所以我真的要解決這個問題
應該處理文章的路線按預期工作,並不關心傳入的請求url的外殼,這使得這種情況很奇怪,因爲路由是指向相同的RedirectController。
任何幫助將不勝感激,如果您需要任何額外的信息我會很樂意提供它
問候
//ķ