Redirection loop with WPML still present
-
Hi, I saw the the topic opened by Paul Bearne and titled “redirection loop with WPML”. It’s marked as resolved, but I still have that same problem.
My site is configured to work with HTTPS, and in wp_options table both ‘siteurl’ and ‘home’ options ad set to ‘https://www.mydomain.com’.
My site is multilanguage, using WPML plugin. Three languages are configured: https://www.mydomain.com/it/, https://www.mydomain.com/en/, https://www.mydomain.com/es/ and all is fine.
But when I activate your plugin, the browser start redirecting from https://www.mydomain.com/it/ to https://www.mydomain.com/it//it/ and then https://www.mydomain.com/it//it//it/ and so on. An infinite redirects chain.
By debugging your code I found that probably the problem is in lh-hsts.php on line 71:
if($this->current_domain == "https://". $this->domain || $this->current_domain == "https://". $this->domain){
because just before the first redirect above, the values of ‘current_domain’ and ‘domain’ are:
$this->current_domain: https://www.mydomain.com/it/
$this->domain: ‘www.mydomain.com’so the two comparisons cannot be true.
Probably the WPML plugin change somehow the ‘home’ value returned by get_home_url() (line 47 of your code) so that the ‘if’ on line 71 always return false, so the ‘else’ branch is executed.
Here the redirect is built with $this->current_domain together with $this->uri, and uri is ‘/it/’ so the redirect url is: https://www.mydomain.com/it//it/The same happens when the browser follows this redirect: $this->current_domain is the same as before, the ‘if’ is false, and a new redirect is built, but this time the $this->uri value is ‘/it//it/’, so the final redirect url is: https://www.mydomain.com/it//it//it/
And so on.How to solve the problem?
- The topic ‘Redirection loop with WPML still present’ is closed to new replies.