How does the SEO Friendly URL redirect work?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
I have a shop running with SEO friendly URL option enabled. I noticed that when I go to the root domain of my shop, it redirects to a new URL depending on the language chosen by the user.

Example:

www.exampleshop.com/cart

Becomes:

(English) www.exampleshop.com/en/cart
(Dutch) www.exampleshop.com/nl/cart

What kind of redirect does nopcommerce use? (301, 302?) And where does nopcommerce initiate the redirect? (code examples?)
10 years ago
Hi,

The kind of redirect is 301.

You can see the code in \Nop.Web.Framework\LanguageSeoCodeAttribute.cs :

//process current URL
            var pageUrl = filterContext.HttpContext.Request.RawUrl;
            string applicationPath = filterContext.HttpContext.Request.ApplicationPath;
            if (pageUrl.IsLocalizedUrl(applicationPath, true))
                //already localized URL
                return;
            //add language code to URL
            var workContext = EngineContext.Current.Resolve<IWorkContext>();
            pageUrl = pageUrl.AddLanguageSeoCodeToRawUrl(applicationPath, workContext.WorkingLanguage);
            //301 (permanent) redirection
            filterContext.Result = new RedirectResult(pageUrl, true);
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.