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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: America/Los_Angeles (GMT-08:00)

Tagged: 

This topic contains 6 replies, has 1 voice.

Last updated by yubicoI 4 hours, 24 minutes ago.

Assisted by: Bobby.

Author Posts
December 4, 2024 at 7:10 pm #16474074

yubicoI

Background of the issue:
I am trying to visit either of the following pages and change the language to anything besides English, which causes an infinite redirect loop to the other page. The pages are: hidden link and hidden link. I attempted to set this up using a WordPress playground but needed to register the WPML plugin on the test site, which seemed out of scope. I suspect this issue is related to how WordPress handles canonical redirects and the omission of the parent page in query vars. I tried disabling canonical redirects, but the issue persisted with inconsistent results across browsers. I need help pinpointing the source of the issue.

Symptoms:
When attempting to change the language on the specified pages, WPML causes an infinite redirect loop between the two pages. The expected behavior was to redirect to the homepage in the selected language, but instead, it redirects back and forth between the two pages.

Questions:
How can I resolve the infinite redirect loop between pages with a common slug but different parents?
Is there a way to configure WPML to handle redirects without changing the page slugs?

December 6, 2024 at 10:00 am #16485293

Laura
Supporter

Languages: English (English ) Italian (Italiano )

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

Hi,

thanks for contacting us.

Before further debugging the issue, could you please update WPML and String Translation? You're using an old version which isn't compatible with your WordPress version, so there's a chance your issue might be solved with an update.

December 9, 2024 at 2:10 pm #16493533

yubicoI

Hey there, that was the first thing I tried, but it didn't resolve the issue. I uploaded the diagnostics file after rolling back my local environment since I made a lot of tweaks to debug this, which is why it shows the older versions, but, after rolling back, I did update everything, and, still see the issue.

For what it's worth, I see this issue when disabling all plugins besides WPML as well as switching my theme to a stock WordPress theme like TwentyTwentyFive and visiting the relevant URLs directly.

December 9, 2024 at 5:31 pm #16494587

Bobby
Supporter

Languages: English (English )

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

Hi there,

The issue is happening only with the translations correct? When I test the default language URLs I get 200 OK.

The translations do give me a 301 redirect

>>> hidden link

> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------

Status: 301 Moved Permanently
Code: 301
Connection: close
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Redirect-By: WPML
Location: hidden link
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Via: 1.1 google, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Mon, 09 Dec 2024 17:29:20 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Served-By: cache-par-lfpg1960039-PAR
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1733765360.449660,VS0,VE305
Vary: Accept-Encoding

>>> hidden link

> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------

Status: 301 Moved Permanently
Code: 301
Connection: close
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Redirect-By: WPML
Location: hidden link
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Via: 1.1 google, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Mon, 09 Dec 2024 17:29:21 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Served-By: cache-par-lfpg1960045-PAR
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1733765361.788551,VS0,VE308
Vary: Accept-Encoding

>>> hidden link

> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------

Status: 301 Moved Permanently
Code: 301
Connection: close
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Redirect-By: WPML
Location: hidden link
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Via: 1.1 google, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Mon, 09 Dec 2024 17:29:21 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Served-By: cache-fra-eddf8230057-FRA
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1733765361.118006,VS0,VE337
Vary: Accept-Encoding

>>> hidden link

> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------

Status: 301 Moved Permanently
Code: 301
Connection: close
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Redirect-By: WPML
Location: hidden link
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Via: 1.1 google, 1.1 varnish
Accept-Ranges: bytes
Date: Mon, 09 Dec 2024 17:29:21 GMT
Age: 0
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Served-By: cache-par-lfpg1960087-PAR
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1733765361.483954,VS0,VE1
Vary: Accept-Encoding

>>> hidden link

> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------

Status: 301 Moved Permanently
Code: 301
Connection: close
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Redirect-By: WPML
Location: hidden link
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Via: 1.1 google, 1.1 varnish
Accept-Ranges: bytes
Date: Mon, 09 Dec 2024 17:29:21 GMT
Age: 1
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Served-By: cache-par-lfpg1960050-PAR
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1733765362.515197,VS0,VE1
Vary: Accept-Encoding

Please go to WPML->Lanugages and switch your language URL format to Different languages in directories, and let me know your results.

December 10, 2024 at 7:47 pm #16500252

Bobby
Supporter

Languages: English (English )

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

Hi there,

Following up on this, were you able to review the information shared above?

December 11, 2024 at 7:08 pm #16505189

yubicoI

Just to be clear, the pages in question do not have translated versions, the intended experience is that a user is sent to the homepage in the language they chose if attempting to change language on one of those pages. Other pages on the site do this correctly. This problem is also solved by using non-unique slugs for the pages, but, WordPress and WPML should support identical slugs like this as far as I understand considering the parent is different.

If I change the URL format to "Different languages in directories", I have the following redirects reliably

hidden link
goes to
hidden link

hidden link
goes to
hidden link

The redirection is by WPML (looking at the HTTP headers)

December 11, 2024 at 7:10 pm #16505192

yubicoI

Just a note that I'm testing these settings changes locally, nothing with my live site configuration has changed.