Double Unique SEO code when SEO friendy Urls enable (3.20)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
OK. I was finally able to find the issue. It can be reproduced it only on localhost and only in Visual Studio 2012 (not 2013). VS 2012 has some limitations when working with MVC 5. Seems that this routing issue is one of them.

So the solution is to just start using of VS 2013.
10 years ago
Windows 7 SP1. Which version is everyone else on?
10 years ago
oumiller21 wrote:
Windows 7 SP1. Which version is everyone else on?

Please see my post above
10 years ago
Thanks Andrei!
10 years ago
https://www.nopcommerce.com/boards/t/26801/double-unique-seo-code-when-seo-friendy-urls-enable-320.aspx
10 years ago
After disabling
SEO friendly URLs with multiple languages enabled:

now site is working fine. but If I enable this i am getting seo codes doubling in the urls.
10 years ago
is this routing issue documented in on VS 2012 issues on microsoft. or its just your assumption.
10 years ago
ssumair wrote:
...

please see my post above:

"SEO friendly URLs with multiple languages enabled" does not work when running localhost in VS 2012. The solution is to use VS 2013.
10 years ago
Here is a quick fix for this (the only problem is that link for the Administration will still have problem with inserted language code part)


This is method in LocalizedRoute.cs which appends extra language code before virtual path.  Change is marked in bold.

/// <summary>
        /// Returns information about the URL that is associated with the route.
        /// </summary>
        /// <param name="requestContext">An object that encapsulates information about the requested route.</param>
        /// <param name="values">An object that contains the parameters for a route.</param>
        /// <returns>
        /// An object that contains information about the URL that is associated with the route.
        /// </returns>
        public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
        {
            VirtualPathData data = base.GetVirtualPath(requestContext, values);

            return data; //We return before extra language code part is added to URL. The remaining code will not execute.

            if (DataSettingsHelper.DatabaseIsInstalled() && this.SeoFriendlyUrlsForLanguagesEnabled)
            {
                if (data != null)
                {
                    string rawUrl = requestContext.HttpContext.Request.RawUrl;
                    string applicationPath = requestContext.HttpContext.Request.ApplicationPath;
                    if (rawUrl.IsLocalizedUrl(applicationPath, true))
                    {
                        data.VirtualPath = string.Concat(rawUrl.GetLanguageSeoCodeFromUrl(applicationPath, true), "/",
                                                         data.VirtualPath);
                    }
                }
            }
            return data;
        }
10 years ago
Same problem here as well for version 3.30 (NopCommerce with source)

Using Windows 7 Prof
Visual Studio 2012 Professional (using the ASP.NET development server)

In NopCommerce, after having set (under Localization Settings)
SEO friendly URLs with multiple languages enabled
and using url: http://localhost:15536

it redirects to: http://localhost:15536/en/

The link to (for example) HOME PAGE becomes:

http://localhost:15536/en/en/

and will result in a Page not found

(other links on the home page also contain double SEO codes)

I have defined two active languages (English and Dutch)
For Language details I did set the Unique SEO code for the languages (en and nl in my case).

For now, I need to turn off SEO friendly URLs with multiple languages enabled but I hope that someone can tell how to make it work properly or explain why it does not work for at least some people...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.