marek_lani
marek_lani

Reputation: 4123

Translating Url to another language for SEO purposes in asp.net mvc4

I am developing web app using asp.net mvc4. The plan for the future is that it will be multi-language app. The names of all controllers and actions are in english but I want to translate url to my native language(Slovak) because of SEO purposes and I want to leave the names of controllers and actions in english.

So for example I want to change the url home/about to uvod/o_nas (slovak translation)

I spent some time on google, but I was not able to find any comprehensive solution so I want to ask for help here.

Thank you in advance.

Upvotes: 2

Views: 911

Answers (2)

user223532
user223532

Reputation: 11

Here's a project I've done that does this with attributes and reflection. It allows you to maintain a more sane route map.

https://github.com/mwardrop/MVC4BilingualURLS

We maintain a French and English version of all urls with 3 routes.

Upvotes: 1

Vinod Kumar Y S
Vinod Kumar Y S

Reputation: 628

I think you need to add language specific routes to achieve that.

routes.MapRoute(
name: "Default", 
url: "uvod/o_nas/{id}", 
defaults: new { controller = "Home", 
                action = "About", 
                id = UrlParameter.Optional });

Upvotes: 1

Related Questions