简体   繁体   中英

ASP.NET MVC Localization with SEO in mind

I have found several options how to properly localize my asp.net mvc project, but still have some doubts selecting the right one.

Want to mention that I need to localize site the way i would be still able to make SEO optimizations for each language separately

Here are the options i found:

  1. First : create a subdomain for different culture:

    mysite.com - for default language and

    it.mysite.com - for italian language

  2. Second : Create new route with subfolder querystring, like

    mysite.com/default - for default language and

    mysite.com/it/default - for italian language

There are no problems on implementing first option.

And if the second option is more preferable... could anyone describe how it should be implemented?

Depends what SEO effect you wanna achieve. But generally if all pages are on the same domain, it's better for SEO => mysite.com/it/default is better

Except if you have a real local business, then you could even go with different top level domains. Eg mysite.de and mysite.it

In therms of MVC:

routes.MapRoute(
    name: "Default",
    url: "{languageCode}/{controller}/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
    constraints: new { languageCode = @"de|fr|en|it" },
    namespaces: new[] { "SupertextMvc.Controllers" } // only map routes to controllers in the specified namespace
    );

This is our routing configuration

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM