• Our Polylang installation has the “Hide URL language information for default language” unchecked. Our website is translated into 3 languages: en, de and ro. En is selected as default language in Polylang.

    If a visitor tries to acces https://mca.electricmura.ro/, (s)he’s redirected to https://mca.electricmura.ro/en/, which I understand is done by Polylang when the “hide URL […]” is unchecked.
    Our surprise is that the redirection to English only happens for the homepage, but not for other pages.

    For example, https://mca.electricmura.ro/repairs/ does not redirect to https://mca.electricmura.ro/en/repairs/

    Furthermore, our tests show that https://mca.electricmura.ro/repairs/ is randomly assigned to a language. Sometimes we get the English page, sometimes the German page. It probably depends on the cache, browser settings, location etc. But it seems like Polylang is not indicating the default language for displaying other pages except for the homepage.

    Is this the normal behavior ? Is anybody else having this problem ? Did somebody find a solution ?

    Thank you !

    • This topic was modified 5 years, 10 months ago by mihaela.g.
    • This topic was modified 5 years, 10 months ago by mihaela.g.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Chouby

    (@chouby)

    Hello,

    This works for me on my test install. Note that the redirect that you are expecting is not made by Polylang but handled directly by WordPress. WordPress calls that “canonical redirect” and this is a 301.

    I noticed that your site uses shared slug /repairs/ across all languages. This feature is not available in Polylang, but it is in Polyang Pro. If you are using Polylang Pro, please contact our support helpdesk.

    Thread Starter mihaela.g

    (@mihaelag)

    Thank you for the quick reply !
    Let me break down the information in your reply so I can pair your answers with the questions in my post and see if I understand correctly.

    <<This works for me on my test install.>>
    Do you mean that you tried to install a general wordpress dummy website, installed the Polylang plugin, left the “Hide URL language information for default language” unchecked and then observed that:
    1. the generic URL (let’s say https://example.com) redirects to the default language you set in Polylang (let’s say https://example.com/en) – this is a 302 redirect done by Polylang and works for us too
    2. any other generic URL (e.g. https://example.com/page-1) redirects to that page in the default lnaguage (let’s say https://example.com/en/page-2) – this is the part that does not work on our website
    Is my understanding occrect, is this what you mean by the above quoted statement ?

    <<Note that the redirect that you are expecting is not made by Polylang but handled directly by WordPress.>>
    Which redirect is handled by WordPress ? I am confused by this statement because I am not using any other multilanguage plugin. If I didn’t have Polylang, there would be no ‘en’, ‘ro’ or ‘de’.
    So I don’t know how WordPress handles language redirects… I thought WordPress doesn’t have default support for a multilingual website. Can you please expand on the above quoted statement ?

    <<I noticed that your site uses shared slug /repairs/ across all languages. This feature is not available in Polylang, but it is in Polyang Pro.>>
    I actually thought that being able to change the slug for each language was a Pro feature. We weren’t keeping the ‘repairs’ slug the same across all languages on purpose, we couldn’t figure out how to set one for each language, actually. Are you sure that language customisation of the slug is a free option ?

    • This reply was modified 5 years, 10 months ago by mihaela.g.
    Thread Starter mihaela.g

    (@mihaelag)

    For anyone else experiencing what I’ve described in my initial post, here’s what I figured out:

    1. When “Hide URL language information for default language” is not checked, then two things should happen:

    1.1 The homepage is redirected to homepage/en or whatever your default language is. This is done by a 302 redirect by Polylang. According to replies I got on Google Webmaster Support forums (https://productforums.google.com/forum/#!topic/webmasters/wgKFrGwW-EA;context-place=forum/webmasters) and StackExchange (https://webmasters.stackexchange.com/questions/120146/google-search-displays-the-english-version-of-a-webpage-for-a-romanian-keyword-s) the 302 redirect upsets Google and should be replaced with a 301 redirect. It’s possible, if you modify the plugin files. You’ll find instructions by @chouby on another thread here I believe for.

    1.2 Your ‘posts’ and ‘pages’ will also be redirected to the ‘en’ or the default language if a user tries to access the link without having the language included in the URL.

    What I mean: if user tries to go to example.com/page-1 -> (s)he’ll get redirected to example.com/en/page-1.
    In my case, this only appeared not to happen, because I was lookign at pages that are neither ‘post’ nor ‘page’. They are a more complicated thing created by my theme. The redirect does happen for all other regular ‘pages’ or ‘posts’.

    I believe this is the 301 redirect that @chouby mentioned in his previous message. It is, of course, initiated by Polylang. I think Chouby meant to say that WordPress implements the actual mechanism for redirects, but the redirect instruction is given by the Plugin, it doesn’t make sense otherwise.

    2. The best approach is to hide URL for the default language, though. It makes life easier. And you might figure out after one year that you should have done this from the start, but then you have to change your links in all your Google Ads and Facebook Ads and add 301 redirects from the old links to the new links because now many website are pointing to you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Polylang redirects to ‘en’ subdirectory only when user tries to access homepage’ is closed to new replies.