• Hello,

    I am having a problem with my site regarding search.

    When I make a search, for example “bed” this is the url that shows

    mywebsite.com/en/en/?s=bed&post_type=product

    However, as you can see it duplicates /en and, therefore, it shows an 404 error page.

    The URL should be like this

    mywebsite.com/en/?s=bed&post_type=product

    How can I possibly fix this?

    I don’t know if this is somehow related to Permalink Manager but I leave it here just in case

    Best Regards

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @tiagonunes,

    could you check if the issue persists when my plugin is deactivated? Also, if possible, could you send me the URL of your website?

    Best regards,
    Maciej

    Thread Starter tiagonunes

    (@tiagonunes)

    Greetings,

    Thankk you for your reply.

    I deactivated your plugin and the problem persists so I think this is related to Polylang.

    Here is the link -> https://dev.laskasas.com/en/

    Best Regards

    Plugin Author Maciej Bis

    (@mbis)

    Hi @tiagonunes,

    I am not certain how does it look in the back-end, but the problem might be also in the theme. Could you try to add this little code snippet to functions.php in your (child) theme directory?

    add_filter('home_url', function($url) {
    	return str_replace('/en/en', '/en', $url);
    }, 100);

    Best regards,
    Maciej

    Thread Starter tiagonunes

    (@tiagonunes)

    Greetings,

    I did that and it does not work it seems.

    This seems indeed related to polylang somehow.

    When I activate this option -> https://ibb.co/wddmgRd
    The search in the default language (English) works because the urls looks like this -> mywebsite.com/en/?s=bed&post_type=product

    Best Regards

    Plugin Author Maciej Bis

    (@mbis)

    Hi @tiagonunes,

    Ok, I see – it looks indeed like a Polylang bug.

    Best regards,
    Maciej

    Thread Starter tiagonunes

    (@tiagonunes)

    But just one more thing and I don’t know if this is related to permalink manager

    I created my homepage with a different URL -> https://dev.laskasas.com/home-english/

    And when I make a search this is the url -> https://dev.laskasas.com/en/home-english/?s=bed&post_type=product

    It adds the URL of the homepage to the search results.

    Can this maybe be related to permalink manager?

    Best Regards

    Plugin Author Maciej Bis

    (@mbis)

    Could you check if the second issue persists when my plugin is deactivated?

    Thread Starter tiagonunes

    (@tiagonunes)

    Greetings,

    Yes it persists.

    I even changed my homepage to the latest post blogs and the problem continues to happen.

    Will try my luck with polylang support.

    Thanks anyway

    Best Regards

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Problem with duplicate language in URL’ is closed to new replies.