Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing an issue where accessing a URL with a language parameter (e.g.,

https://www.campmontana.ch/food/?lang=fr

) does not result in a 404 error, even though the 'Different languages in directories' option is enabled in WPML. Instead, the page is displayed in the default language.
Solution:
We have confirmed that the behavior observed is expected when 'Different languages in directories' is selected in WPML settings. WPML is designed to interpret URLs with language parameters as an attempt to access the page in the default language, not following the directory structure. To manage this and potentially redirect to a 404 page, we recommend using redirection plugins such as Redirection, Smart Custom 404 error page, or Yoast SEO. These plugins can help customize the URL behavior and manage redirects within WordPress.

If this solution does not seem relevant to your situation, please feel free to open a new support ticket here.

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.

This topic contains 3 replies, has 3 voices.

Last updated by Mateus Getulio 12 months ago.

Assisted by: Mateus Getulio.

Author Posts
January 11, 2024 at 7:52 pm #15176436

Romit Ambaliya

Hello Team,

We have kept URL format as "Different languages in directories" (i.e. hidden link).

But when I try to visit language name added as a parameter (i.e. hidden link), it gives me the result of default language of page (i.e. english). Instead, it should say 404.
hidden link should not be working since we kept URL format as "Different languages in directories".

How can we fix this?

Thanks

Screenshot_1.jpg
January 11, 2024 at 8:29 pm #15176542

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

I believe what you are experiencing is due to a known issue our team has included a fix for in the latest release of WPML (4.6.9)

Please go to Plugins->Add new->Commercial tab-> check for updates and updates to the latest version of WPML.

Or go to https://wpml.org/downloads/ to download manually if not available yet.

After updating WPML let us know if thee issue persists

January 12, 2024 at 6:13 am #15177235

Romit Ambaliya

I have tried updating te plugin but it still doesn't work. Can you please guide me?

January 12, 2024 at 5:49 pm #15180481

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

Thanks for your reply.

I'm afraid the behavior you are observing is expected and related to the language URL structure chosen in WPML.

When you set "Different languages in directories", WPML expects languages to be represented by directories in the URL. Then, if you try to access hidden link, WPML interprets this as an attempt to access the "food" page in the default language (English), as it is not following the directory structure defined.

For instance, I have tested the same behavior in a clean Sandbox install, and we can see it also happens there:

- hidden link
- hidden link

If you want to avoid or even change it, redirection plugins (such as Redirection, Smart Custom 404 error page, Yoast SEO and many others) can be useful for managing redirects and customizing the URL behavior in WordPress.

Please let me know if this info is clear to you and solves the question. Thank you!

Regards,
Mateus.