Home›Support›English Support›[Resolved] WPML SEO plugin + setting WPML Default Language to own directory causing infinite redirection loop
[Resolved] WPML SEO plugin + setting WPML Default Language to own directory causing infinite redirection loop
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing an infinite redirection loop when visiting the English version of their site with the WPML SEO plugin activated. This issue arises after changing their setup to have each language in its own directory, with an HTML page at the root URL that redirects based on browser language.
Solution: 1) Ensure you are following the steps in our documentation to set up the Language Directory for the default language: Redirect the root domain to the default language Language setup for directory default language 2) Upgrade to the latest version of WPML plugins (4.8.1 series). 3) Go to WPML >> Languages >> Languages URL format, and resave the settings. 4) Visit Settings >> Permalinks, and resave the settings. 5) Clear all types of caches. 6) Check for unexpected redirects set inside the "Redirection" plugin or other SEO plugins like Yoast SEO Premium, as these might conflict with WPML's settings.
If these steps do not resolve the issue, it might be due to specific configurations or conflicts within your site. We 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 persists, please open a new support ticket.
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.
Background of the issue:
I am trying to set up a WPML configuration where each language has its own directory. We have moved from a setup where each language had its own domain to the following setup: Default Language to own directory and using an HTML page for the root URL. The languages and mapping directories are: hidden link (default language), hidden link, hidden link. Additionally, we have a hidden link file that redirects based on the browser language. The issue occurs when the WPML SEO plugin is active.
Symptoms:
When the WPML SEO plugin is active, visiting the English site at hidden link causes an infinite redirection loop. The user is redirected to hidden link, which calls the redirect.html file, redirecting the user back to hidden link, and so on. Deactivating the WPML SEO plugin resolves the issue.
Screencast: hidden link
Questions:
How can I resolve the infinite redirection loop caused by the WPML SEO plugin?
Is there a way to use both WPML and WPML SEO without encountering this issue?
If the issue persists, please try these steps after creating a full site backup, and then check if the problem still exists:
1) Upgrade to the latest version of WPML plugins (4.8.1 series)
2) Go to WPML >> Languages >> Languages URL format, and resave the settings
3) Visit Settings >> Permalinks, and resave the settings
4) Clear all types of caches
Thank you for the updates. Please go to Plugins >> Add Plugins >> Commercial tab and click on the "Check for updates" button. This will refresh the installer cache and display the automatic upgrade links for the latest version of WPML.
Please try this after taking a full site backup and let us know your feedback.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Hello,
Currently, once I visit your site, I get redirected to hidden link. There is no infinite loop occurring on my test. Anyhow, my browser language is actually set to English.
Could you please pass me the markup of your redirect.html file so that I can try to replicate the issue in a sandbox?
On your site, please verify if there are any unexpected redirects set inside the "Redirection" plugin.
If you would like to give it a try yourself, you can log in to the test site here: hidden link
Note that I already ran a test, but so far the issue has not occurred, which means the issue might be related to your HTML file or even to some code inside the theme or another plugin.
The logimatiq.com website has the WPML SEO plugin deactivated.
Here is the markup of the redirect.html file:
```
<html>
<head></head>
<body>
<script>
var userLang = navigator.language || navigator.userLanguage;
var urls = {
'en': 'en/',
'fr': 'fr/',
'de': 'de/'
};
var defaultUrl = 'fr/';
var url = urls[userLang.substring(0,2)] ?? defaultUrl;