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
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 -

Supporter timezone: Europe/Zagreb (GMT+01:00)

Tagged: 

This topic contains 4 replies, has 0 voices.

Last updated by Dražen 4 days, 9 hours ago.

Assisted by: Dražen.

Author Posts
March 3, 2025 at 9:26 pm #16770926

wernerT-3

Background of the issue:
I have upgraded from WPML v4.6.3 to v4.7.1 and now the redirection for my connected languages homepage is different. The homepage for the default language (default = en) can now be reached under: /en and /en/, which is OK. But the connected homepage for other languages like DE + FR can now only be reached like /de and /fr but not anymore under /de/ and /fr/ - those last to redirect to /de and /fr. Note that hidden link is my development domain not accessible to the outside - it is the local development for hidden link. On the production site: hidden link still the old version is running and does support /fr/ and /de/. I did turn off all other plugins except for WPML v4.7.1 - no other plugin is running. I also switched theme to the standard WordPress Twenty Twenty Five v1.1 theme. On the link to the page you can see WPML v4.6.3 running that does correctly show the German connected homepage on /de/. Link to a page where the issue can be seen: hidden link

Symptoms:
The country languages can only be seen on /de and /fr instead of /de/ and /fr/ as expected.

Questions:
Why does the redirection for connected language homepages differ after upgrading to WPML v4.7.1?
How can I make the country language homepages reachable with a trailing slash like /de/ and /fr/?

March 5, 2025 at 10:44 am #16777860

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

Thanks for contacting us.

I just checked on the test site with the same settings/permalinks, and it works just fine with the latest WPML 4.7.1, so it could be something specific to your environment/website.

Please create and share a staging site where we can check this issue further. I have enabled private reply.

Thanks,
Drazen

March 5, 2025 at 10:47 am #16777882

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

you also say: "But the connected homepage for other languages like DE + FR can now only be reached like /de and /fr but not anymore under /de/ and /fr/ - those last to redirect to /de and /fr"

But if I check your live website is see that /en redirect to /en/, so not sure what is expected behaviour for you on live / staging site.

Regards,
Drazen

March 5, 2025 at 12:23 pm #16778414

wernerT-3

Hi Drazen,

Let me first reply to you last question: "so not sure what is expected behaviour"

The expected behavior, which works up to at least 4.6.3 (and not anymore already in 4.6.8 - see previous ticket) - is that homepages can be reach under the URL with a slash at the end. Like /de/ and /fr/ - this does work for /en/ in the new version but only for the default language ( EN is default language ) and not for any language.

On the Live site in our .htaccess file we redirect from /fr , /de , /en to respectively /fr/ , /de/ , /en/

-------------

In your first reply you state: "it works just fine" , but in your second reply you state "not sure what to expect".
Now I wonder about your first reply, what does work fine?
On your test site can you view any language homepage on /xx/ ( so, with trailing-slash ) ?
Since I do know that it does work for the default language, just not for the other languages.

------------

Since it is impossible to grand sftp access due to IP restrictions, I can only give you access to our staging environment and that iis already hard to do as this is a controlled environment connected to GitLab for deployments with separate .htaccess + wp-config.php deployments and connections - with specials connections NFS files for uploads and other shares.

It would be much easier if we can setup a teams-call and I share my screen which you can takeover.

------------

A side-effect that I noticed is that the function "url_to_postid" neither works for these homepages:

Failed to resolve URL: hidden link
Failed to resolve URL: hidden link
Failed to resolve URL: hidden link
Failed to resolve URL: hidden link
Resolved URL: hidden link to ID: 2
Resolved URL: hidden link to ID: 12778
Failed to resolve URL: hidden link
Failed to resolve URL: hidden link
Resolved URL: hidden link to ID: 5827
Resolved URL: hidden link to ID: 14636

-------------

I did find a work-around for wpml redirecting /de/ ( or /fr/ ) back to /de or /fr

This is my work-around:
function check_wordpress_redirects($redirect_url, $requested_url)
{
if ($redirect_url . "/" === $requested_url) {
$parsed_url = parse_url($redirect_url);
$path_info = pathinfo($parsed_url["path"]);
if($path_info["dirname"]=="/"){
return false;
}
}
return $redirect_url;
}

add_filter('redirect_canonical', 'check_wordpress_redirects', 99, 2);

In local dev I use global.it.atos.net as the domain for atos.net (prod live site)
For a homepage request for "hidden link", the $redirect_url reads:
"hidden link" - so I then make a check to see if adding the slash to the redirect is the same as the requested, then I check if this is happening inside the "root" of the site, so only for /xxxx and not any subfolder - and if so, just cancel the redirect "return false".
Now the homepage for /de/ does show correctly.

When I would even invest time actually debug wpml code I might be able to pinpoint where your redirection doing this for /fr/ and /de/ but not for /en/ ...
Next I would need revert to 4.6.3 and see why it does work correctly in that version.
But I guess I become a wpml developer ;-)))

I hope this clarifies the issue more clearly and you will be able to replicate this behavior on you side. If not, if you can reach your language homepage with slash at the end, then there might be something wrong with the database content. since I never created a clean install.

If you like to setup teams call that would be welcome as well. Just propose a date/time.

Kind regards,
Michel Waaijer ( on behalf of Ralph / Atos )

March 5, 2025 at 12:50 pm #16778631

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello Michel,

Thanks for the detailed reply; it is really helpful.

I was able to reproduce the issue and confirm your findings. I have now escalated this issue to our 2nd tier to check and escalate it further.

I will update you when I have some news, it may take a day or two.

Regards,
Drazen