Always 302 redirects to default language, why?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hi. I have a site with two languages, English and French. English is the default language. If I visit a French language page on on clean browser (cookies and cache cleared), mysite.com/livres, I'm always redirected to its English language equivalent, mysite.com/books. Surely it would make sense if a use enters your site on a secondary language page that they continue to browse in that language. It provides a poor user experience in search for example if results are in French and the visited page redirects the user to the English language version. Or am I missing something?

Technically, how does the redirect happen? I can block cookies on mysite.com and the redirect still occurs.

I could enable detect language based on browser and the user will stay on the French language page if their browser language is set to French. I don't want to rely on this. I could also enable SEO friendly URLs with language code. No redirect takes place in this instance. If I visit mysite.com/fr/livres on a clean browser I stay here.

The original issue does have some SEO implications. 9 times out of 10 if I fetch as Google an English language page the URL is fetched as English. On the odd occasion it detects a 302 redirect and wants to fetch the French language version instead. This issue is evident in search results whereby there could be a French meta title and description and an English language URL or vice-versa. Regardless of this when a user clicks through they're presented or redirected to the English language page.

I've tested this in nopCommerce 3.5 and 3.9 on the default theme. Is there any way to prevent this default language routing? Does it function like this for a reason?
6 years ago
mccarrd4 wrote:
Hi. I have a site with two languages, English and French. English is the default language. If I visit a French language page on on clean browser (cookies and cache cleared), mysite.com/livres, I'm always redirected to its English language equivalent, mysite.com/books. Surely it would make sense if a use enters your site on a secondary language page that they continue to browse in that language. It provides a poor user experience in search for example if results are in French and the visited page redirects the user to the English language version. Or am I missing something?

Technically, how does the redirect happen? I can block cookies on mysite.com and the redirect still occurs.

I could enable detect language based on browser and the user will stay on the French language page if their browser language is set to French. I don't want to rely on this. I could also enable SEO friendly URLs with language code. No redirect takes place in this instance. If I visit mysite.com/fr/livres on a clean browser I stay here.

The original issue does have some SEO implications. 9 times out of 10 if I fetch as Google an English language page the URL is fetched as English. On the odd occasion it detects a 302 redirect and wants to fetch the French language version instead. This issue is evident in search results whereby there could be a French meta title and description and an English language URL or vice-versa. Regardless of this when a user clicks through they're presented or redirected to the English language page.

I've tested this in nopCommerce 3.5 and 3.9 on the default theme. Is there any way to prevent this default language routing? Does it function like this for a reason?


I can see in the code where this may be occurring. Although you are viewing the french page, french isn't the current language, i.e. you haven't selected french as your working language. Just viewing a page doesn't do that - as far as i can see (anyone correct me if i'm wrong) you have to select it from the language selector.
6 years ago
If I search for a product in google.fr I'm more than likely given a French result. The user would click through and then be brought to an English language page despite having the intention of visiting a French language page. This provides a really bad experience for the user. On a clean browser (visitor's first hit to the website) it would make sense if their landing page is a secondary language page that that be set as the working language? This also has to affect site crawling as Google will adhere to the 302 redirect when it visits a French language page without that language set?
6 years ago
This throws up all sorts of questions/issues.

A simple setting to override this behaviour would be handy but i'm guessing it was coded this way for a reason.

https://github.com/nopSolutions/nopCommerce/blob/master/src/Presentation/Nop.Web.Framework/Seo/GenericPathRoute.cs#L139
6 years ago
Yes, I'm wondering what is the intention behind this behaviour? To me it doesn't make sense from a usability point of view or in terms of search optimisation. Any one else know what it functions this way?
6 years ago
Well I tried to create a simple plugin to override this behaviour, unfortunately the class that is responsible for it is being 'new'ed in a helper class (naughty) so thats a bust.

You would need to amend the core code to implement Language Negotiation but its possible, based on a simple set of rules. I read google's bot is also language aware and sets the appropriate headers so applications can respond based on the perceived language rather than an ip.
6 years ago
Does any nopCommerce team member know why language functions this way?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.