WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
Failing to redirect properly after update. (19 posts)

  1. Ayman
    Member
    Posted 10 months ago #

    Hello,

    After updating polylang to version 1.4.4, the home page keeps on crashing for the non default language.

    The url is resulting like: http://www.example.com/en/en instead of http://www.example.com/en

    Using:
    1- Static home page
    2- Permalink structure settings: /%postname%
    3- Polylang settings:
    - The language is set from the directory name in pretty permalinks
    - Hide URL language information for default language
    - Remove /language/ in pretty permalinks
    - The front page url contains the language code instead of the page name or page id
    - When the front page is visited, set the language according to the browser preference

    Please note the only way to make it work again is to change from:
    - The language is set from the directory name in pretty permalinks
    to
    The language is set from content

    But at this point the language code is lost. So, any Idea or suggestion on how to fix this out and bring the old behavior back would be very much appreciated.

    https://wordpress.org/plugins/polylang/

  2. Chouby
    Member
    Plugin Author

    Posted 10 months ago #

    Could you just try to resave your polylang settings?

  3. Ayman
    Member
    Posted 10 months ago #

    Already tried to re-save polylang settings and resave the permalink settings and nothing changed.
    I have also tried with the default theme and that didn't help.
    Any other suggestions?

  4. Chouby
    Member
    Plugin Author

    Posted 10 months ago #

    Do you remember what was the previous version?

    Try to de-activate all other plugins and switch to a default theme such as twenty twelve.

  5. Ayman
    Member
    Posted 10 months ago #

    Previous version used is 1.4.3

    Already tried deactivating all the plugins used leaving only Polylang with the default theme Twenty Fourteen. Still the same behavior.

  6. Chouby
    Member
    Plugin Author

    Posted 10 months ago #

    I finally reproduced. v1.4.4 is correct with the permalink structure /%postname%/ but not with /%postname%

    Could you edit the file polylang/frontend/choose-lang-url.php at line 89 just below

    // the language is not correctly set so let's redirect to the correct url for this object

    and replace

    if (!empty($language)) {

    by

    if (!empty($language) && (empty($this->curlang) || $language->slug != $this->curlang->slug)) {

    I believe it should fix the issue.

  7. miguelcortereal
    Member
    Posted 10 months ago #

    Same problem here.
    Going to try to the fix.

  8. miguelcortereal
    Member
    Posted 10 months ago #

    Fixed.

  9. schokophil
    Member
    Posted 10 months ago #

    Fixed. Thank you.

  10. Chouby
    Member
    Plugin Author

    Posted 10 months ago #

    Well. This is only a quick fix (revert line from 1.4.4 to 1.4.3) but cannot be a definitive solution as it re-introduces another bug of the previous version.

    So I further worked on it and hopefully came to a better fix. Could you test the development version (1.4.4.2)?
    http://downloads.wordpress.org/plugin/polylang.zip

  11. Ayman
    Member
    Posted 10 months ago #

    @Chouby, I will try the development version and let you know.

  12. Chantal C
    Member
    Posted 10 months ago #

    @Chouby,
    It fixes it almost.
    When having the URL language information for default language not hidden, it still takes the homepage of the default language to mysite.com/nl/nl.
    Any ideas?

  13. Chouby
    Member
    Plugin Author

    Posted 10 months ago #

    @Chantal C
    Do you mean that it works if you hide the language code for the default language and not if it is not hidden? Are you using the development version?

    Could you precise your permalinks settings and your Polylang settings?

  14. Chantal C
    Member
    Posted 10 months ago #

    @Chouby
    That's correct. It works when the language code is hidden for the default language (mysite.com).
    As soon as I turn on the language code, it fails (mysite.com/nl turns into mysite.com/nl/nl).
    My second and third language installed work perfectly now.

    My permalinks are: /%year%/%monthnum%/%postname%/
    But is also occurs when it's just: /%postname%/

    I use the development version.

    Hope this helps.
    Regards

  15. Chouby
    Member
    Plugin Author

    Posted 10 months ago #

    I can't reproduce with the development version.

    Could you precise your Polylang settings?
    Are you using a static front page?
    Could you provide a link?

    Moreover, there is something strange as the initial issue was only for sites with no trailing slash in permalinks.

    Did you resave your Polylang settings?

  16. Chantal C
    Member
    Posted 10 months ago #

    Sure.
    Items checked on the polylang settings:

    Also checked: Custom post types, Custom taxonomies and Synchronization.

    I am using a static homepage.

    Edit:
    Resaving my Polylang setting did the trick! Thanks!!

    Regards

  17. Chouby
    Member
    Plugin Author

    Posted 10 months ago #

    Ok good. I feared I missed something else.

  18. Gonçalo Peres
    Member
    Posted 10 months ago #

    Greetings.
    I had the same configuration and had the same problems:
    "http://mysite/en" was being redirected to "http://mysite/en/en" >> page not found.

    I replaced the current version (1.4.4) for the development version (1.4.4.4) and the problem was fixed.

    Cheers and thank you for fixing it!

  19. Chouby
    Member
    Plugin Author

    Posted 10 months ago #

    Expect v1.4.5 coming soon.

Reply

You must log in to post.

About this Plugin

About this Topic