WordPress.org

Support

Support » Plugins and Hacks » Failing to redirect properly after update.

Failing to redirect properly after update.

  • Ayman

    @aymanalzarrad

    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/

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

    @chouby

    Could you just try to resave your polylang settings?

    Ayman

    @aymanalzarrad

    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?

    Plugin Author Chouby

    @chouby

    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.

    Ayman

    @aymanalzarrad

    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.

    Plugin Author Chouby

    @chouby

    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.

    Same problem here.
    Going to try to the fix.

    Fixed.

    Fixed. Thank you.

    Plugin Author Chouby

    @chouby

    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

    Ayman

    @aymanalzarrad

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

    @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?

    Plugin Author Chouby

    @chouby

    @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?

    @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

    Plugin Author Chouby

    @chouby

    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?

    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

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Failing to redirect properly after update.’ is closed to new replies.