Skip Navigation

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

Problem:
The client is experiencing an ERR_TOO_MANY_REDIRECTS error when using the 'Use directory for default language' option in WPML. Despite following the guide on setting up directory defaults and redirections, the error occurs intermittently.
Solution:
1. We confirmed that the homepage redirection to the language directory is an expected result due to the settings applied. This is in line with the documentation provided at https://wpml.org/documentation/getting-started-guide/language-setup/directory-default-language/#redirect-the-root-domain-to-the-default-language-directory.
2. We suggested checking if the

home_url()

function is being filtered by other plugins or the theme, which might be causing the error. As a troubleshooting step, we recommended using a hardcoded URL (https://****/el) to see if the issue persists.

If this solution does not resolve the issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem continues, please open a new support ticket at WPML support forum.

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.

Tagged: 

This topic contains 16 replies, has 2 voices.

Last updated by Bigul 2 months, 2 weeks ago.

Assisted by: Bigul.

Author Posts
September 27, 2024 at 3:03 pm #16230424

nikolaosM

Background of the issue:
I have checked the option Use directory for default language and followed your guide to achieve this https://wpml.org/documentation/getting-started-guide/language-setup/directory-default-language/#redirect-the-root-domain-to-the-default-language-directory. I have followed this step by step and we did not face any problems since today. The only thing I have not made is changing the page template to the redirect one because it is causing problems with the page design. This is the language settings hidden link.

Symptoms:
ERR_TOO_MANY_REDIRECTS

Questions:
How to solve it

September 30, 2024 at 10:00 am #16235336

Bigul
Supporter

Languages: English (English )

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

Hello,

Please try the workaround suggested in our chat last week after a full site backup and let us know your feedback.

--
Thanks!

Bigul

October 1, 2024 at 8:26 am #16238968

nikolaosM

Hello,

Here is some facts I did not provide when we started our conversation.

First of all this is the site URL settings page hidden link. And this are the settings in the WPML -> Languages section hidden link. We want this settings to have /el in all default language pages. After just saving the settings in the permalinks section, without making any changes, the issue was resolved. We have not made any root page, have not setted the home page template to be the redirect one that you have in your documentation and we have not tried what you suggested because it will cause more redirects and the page will take much longer to load.

We do not have activated any cache system, nor made any changes in the .htaccess file or added snippets in functions.php.

This is the default language home page URL: hidden link

As you can understand when someone presses the default site URL he gets redirected to the Greek homepage. It seams to work now and pretty fast but we can not locate the cause of the problem with ERR_TOO_MANY_REDIRECTS. Is wpml redirecting the site base URL to the Greek homepage?
As you can understand we can not save the permalinks settings every time there is a problem. We need a solution as soon as possible.

Thanks!

October 1, 2024 at 3:42 pm #16241728

Bigul
Supporter

Languages: English (English )

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

Hello,

Thank you for the feedback. Please fill in the private details fields after a full site backup{mandatory}. I would like to access the admin area of your site for further checking. Refer to the following links for more details about our private information-sharing policies.

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

hidden link

--
Thanks!

Bigul

October 3, 2024 at 7:00 am #16248030

Bigul
Supporter

Languages: English (English )

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

Hello,

Thank you for the login information. I am checking with our team for an expert opinion on this. We will get back to you as soon as possible. Please wait.

--
Thanks!

Bigul

October 4, 2024 at 4:37 pm #16255426

Bigul
Supporter

Languages: English (English )

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

Hello,

We were unable to reproduce the issue in a fresh or minimal installation on our end. Typically, creating a root page should not automatically redirect from the site URL (hidden link) to the language directory URL (hidden link). It should remain at hidden link and only redirect after a redirection option has been set.

Therefore please allow me to make a copy of your site using the Duplicator plugin (https://wordpress.org/plugins/duplicator/) for debugging the issue on my local server. So we can troubleshoot the bug without affecting your live site.

--
Thanks!

Bigul

October 7, 2024 at 8:20 am #16259563

nikolaosM

Hello Bigul,

Yes you can proceed with the copy of the site.

Thanks!

October 7, 2024 at 8:45 am #16259719

nikolaosM

Right now if you visit hidden link you will see the problem. I will not make any changes today so you can make a copy.

Thanks!

October 7, 2024 at 3:32 pm #16262593

Bigul
Supporter

Languages: English (English )

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

Hello,

Thank you for the permission and updates. I made a copy of the site and will debug it locally.

One doubt. To make sure, now the URL is automatically redirecting from hidden link to hidden link, are you facing any other issues on the homepage apart from this? Please share your feedback.

--
Thanks!

Bigul

October 8, 2024 at 7:36 am #16264128

nikolaosM

Hello,

No we are not facing any other problems with the homepage. As I have said before we have the site url to be hidden link from settings and the basic language homepage is this hidden link. We do not have a landing page and the redirect is happening on it's own. We want this to work like this but we get the error we are talking about sometimes.

Thanks!

October 8, 2024 at 2:36 pm #16265993

Bigul
Supporter

Languages: English (English )

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

Hello,

Thank you for the updates. I had a few rounds of testing in my local copy. The redirection only happens in the local copy when your child theme is active. If I switch to the Porto parent theme it works as expected.

So can you please check with your developers that the Child theme is supporting any type of redirection logic?

--
Thanks!

Bigul

October 9, 2024 at 8:29 am #16268484

nikolaosM

Hello Bigul,

So I had added a file with the name root-redirect.php in the child theme folder that redirected the root page to the greek home page. After removing it and visiting hidden link I can see that there is a root page without content in it hidden link. I guess this is how WPML is working correctly.

The problem is that we do not want that. And we can not understand why since we have setted the home page to be the page with the name "Αρχική" we get the root page as our home page. As you can see in the Settings -> General we have this as the site URL hidden link and in Settings -> Reading we have this settings for the homepage hidden link. As you can understand what we expect to see when we visit the site's URL is the greek homepage. Can we make this happen without having redirection errors?

Thanks!

October 9, 2024 at 3:35 pm #16271500

Bigul
Supporter

Languages: English (English )

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

Hello,

Thank you for the detailed feedback. I am also getting the expected results in my local copy after deleting the *root-redirect.php* file from the child theme.

It looks like you have followed the steps suggested in the following documentation.

https://wpml.org/documentation/getting-started-guide/language-setup/directory-default-language/#redirect-the-root-domain-to-the-default-language-directory

hidden link

The homepage is redirecting to the language directory (from hidden link to hidden link) because of these settings. So it is an expected result and you have the correct settings now.

Please check it and let us know your feedback.

--
Thanks!

Bigul

2024-10-09_21h04_15.png
October 10, 2024 at 7:24 am #16273121

nikolaosM

Hello,

I know that this is the correct settings to achieve what we want for this site, but sometimes we get the ERR_TOO_MANY_REDIRECTS error. Is this a server related issue? As I said before we get this error sometimes, not always and we are trying to figure out what is going on. This site is going to get live in a week, so if you have a valid answer please provide it.

Thanks!

October 10, 2024 at 1:47 pm #16275497

Bigul
Supporter

Languages: English (English )

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

Hello,

Normally, this redirection should not result in an ERR_TOO_MANY_REDIRECTS error. However, it is possible that home_url() is being filtered by other plugins or the theme. Please try using the hardcoded URL (hidden link) and check if the issue persists.

hidden link

If the problem still exists, kindly provide the exact steps to reproduce the bug.

--
Thanks!

Bigul