What redirection method to use for SEO in my action method using ASP.NET MVC? RedirectToAction or RedirectToActionPermanent?

I am creating a website that will support multiple languages.

I also wanted to localize the url so that it works like this:

  • www.domain.com/en/contact
  • www.domain.com/de/kontakt

For this, I decided to use different controllers for each language.

I also added a code that stores your preferred language in a cookie.

If the same user visits www.domain.com , I would like the code to check this cookie and then redirect the visitor to the index page with the appropriate language.

To achieve this, I have this code in global.asax for the route

routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "en", action = "LanguageRedirect", id = UrlParameter.Optional } 

And then in the ru controller there is a LanguageRedirect method:

  public ActionResult LanguageRedirect() { string cultureName=""; HttpCookie cultureCookie = Request.Cookies["_culture"]; if (cultureCookie != null) { cultureName = cultureCookie.Value; cultureName = cultureName.Substring(0, 2); } // Some custom code that checks valid languages if (!CultureHelper.isValidCulture(cultureName)) cultureName = "en"; return RedirectToAction("Index", cultureName); } 

I'm not sure what the appropriate SEO redirect method should be? Should I use RedirectToAction or use RedirectToActionPermanent ?

+4
source share
1 answer

You should use RedirectToAction (302) instead of RedirectToActionPermanent (301).

You should redirect 301 basically if a new URI has been assigned to the resource and the original is no longer valid.

Cm:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

https://webmasters.stackexchange.com/questions/26876/301-redirects-for-regional-variants-of-a-homepage

+3
source

All Articles