-1

I need your help to understand how can I have an URL in french and one in english that redirect to the same controller in MVC4?

In other words, I have a controller Speciality which have a controller MoreOption

public ActionResult MoreOption()
{
...
}

So we can access this controller via http://{domainname}/Speciality/MoreOption.Now I need to access this controller in french language http://{domainname}/nos-specialites/options-supplementaires. I do not need to write an other controller class because it's the same code I use to show that page.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Karine
  • 385
  • 1
  • 7
  • 18
  • I hope I'm not the first one trying to do this ... – Karine Jul 05 '13 at 17:57
  • I don't really have a solution to your questions, but just wanted to point out that you should be careful that the different pages are not considered as duplicate content by Google and then get penalized. I would recommend that you add the canonical URL tag to the pages specifying which is the authoritative page. – Andy T Jul 05 '13 at 18:07
  • @QuetiMporta: When we use a CMS, we have the choice to rename the URL of every page. I guest we can do that in .NET MVC4 ?? – Karine Jul 05 '13 at 18:41

1 Answers1

1

Actually, this is quite simple if I understand you correctly.

You just have 2 action methods, The English one and the French one that load the same model in the same controller. However, if you have 2 names for the same controller, you could achieve this with routing configuration.

routes.MapRoute(
            name: "FrenchControllerName",
            url: "Home/{controller}/{action}/{id}",
            defaults: new {area="Home",controller = "EnglishControllerName", action = "Index", id = UrlParameter.Optional }
        );
Greg
  • 2,654
  • 3
  • 36
  • 59
  • Thank you @Gref, I have found this http://stackoverflow.com/questions/2146227/how-to-route-a-multiple-language-url-with-a-mvc that help me to understand more. :) – Karine Jul 05 '13 at 20:51