-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.

3
  • I hope I'm not the first one trying to do this ... Commented Jul 5, 2013 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. Commented Jul 5, 2013 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 ?? Commented Jul 5, 2013 at 18:41

1 Answer 1

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 }
        );
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you @Gref, I have found this stackoverflow.com/questions/2146227/… that help me to understand more. :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.