Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 - -
- - - - - - -

Supporter timezone: Asia/Yerevan (GMT+04:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Christopher Amirian 1 year, 7 months ago.

Assisted by: Christopher Amirian.

Author Posts
November 10, 2023 at 5:51 pm #14779639

chakibK

Hi,

I am using the "Different languages in directories" option with the "Use directory for the default language" checked.

The main language is French with a custom language to create the slug /fr-fr/.

So, my main domain is always showing the language prefix domain.com/fr-fr/.

The issue I am facing is that when a user types a URL without the prefix, it does not redirect to the main language prefix. For example, domain.com/about/ should redirect to domain.com/fr-fr/about, but this is not the case. The redirection only takes place when we go to a post or CPT URL, for example, domain.com/blog/post-1. In this case, it will redirect to domain.com/fr-fr/blog/post-1.

How can I solve this issue to always have a language prefix in my URLs, even when we enter a URL without a language prefix?

Thank you.
Reda

November 12, 2023 at 4:54 pm #14784491

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I checked my installation and it works as expected. You can check here:

hidden link

Try to use:

hidden link

It redirects correctly. This shows the default WPML behavior is ok and something is preventing the redirection on your website.

- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except WPML and its add-ons. (Also deactivate WPML CMS Nav and Sticky links)
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.

Thanks.

November 13, 2023 at 8:05 am #14785855

chakibK

Hello Christopher,

I tried to click on this link hidden link but it is working without any redirection. So it does not work for me on your installation neither !

I tried with different devices and browsers... When checking the redirections too there are any.

Screenshot 2023-11-13 at 09.05.18.png
November 13, 2023 at 3:32 pm #14790777

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

That is correct. I guess this is the default behavior of WPML. But I am going to ask for a second opinion and get back to you.

Thanks.

November 15, 2023 at 11:22 am #14807483

chakibK

Hi Christopher, Hope there is a solution to add there. I tried several modifications in the htaccess but it brokes the admin site and images link so i reverted back to normal.

Looking forward hearing from you regarding this issue.
Regards.

November 16, 2023 at 11:05 am #14824715

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you, I already asked about this from second-tier and waiting for their reply.

We are a little bit crowded in the queue but I will get back to you as soon as I have an answer.

November 16, 2023 at 11:10 am #14824753

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Ok I just have got the answer!

That is a bug on our side and our development team is working on this.

A fix will be available on upcoming versions, but there is no ETA at the moment.

Thanks.

November 18, 2023 at 6:08 am #14867167

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

We released a temporary workaround for the issue:

https://wpml.org/errata/wpml-default-language-in-directory-does-not-redirect-properly/

Thank you.