Page 1 of 1

ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Thu Jan 03, 2019 5:53 pm
by Siguana
I have a website which I can reach writing its URL in the web explorer. I can watch the website from there. But, if I try to access the website from Google, I get an ERR_TOO_MANY_REDIRECTS error.

After some research, I discovered that the problem is the Language Filter plugin. Inside the configuration of this plugin, I can turn on the option for hiding the URL of the language, and my website loads properly. But this solution is not valid for me, as there is some custom PHP code that checks the URL for getting the actual language.

Is there an alternative solution?

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Thu Jan 03, 2019 5:57 pm
by leolam
Check with the developer of this code
some custom PHP code that checks the URL
since that is causing the error

Leo 8)

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Thu Jan 03, 2019 6:14 pm
by Siguana
leolam wrote:
Thu Jan 03, 2019 5:57 pm
Check with the developer of this code
some custom PHP code that checks the URL
since that is causing the error

Leo 8)
It is a simple PHP code, so I don't expect it to be causing the problem.

Code: Select all

	$strURL = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
	$intLanguage = strpos($strURL, "/es/");

	if ($intLanguage !== false){
		return "es_ES";
	}else{
		$intLanguage = strpos($strURL, "/ja/");
		if ($intLanguage !== false){
			return "ja_JP";
		}else{
			return "en_GB";
		}
	}

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Thu Jan 03, 2019 7:04 pm
by toivo
Siguana wrote:It is a simple PHP code, so I don't expect it to be causing the problem.
Depends on where the custom code has been added and what it is supposed to do. Why do you think that the multilingual Joomla 3.x does not work without hard-coded modifications?

Does the site use SSL? Which version of Joomla are you using?

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Thu Jan 03, 2019 7:17 pm
by Siguana
The code is added in an external file and other customs extensions. This coding is just for showing some custom text or images acccording to the language.

The site uses SSL. Joomla! version is 3.9.

Actually, I have this code inside my .htaccess file:

Code: Select all

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Actually, it redirects as followes:
And it starts again...

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Fri Jan 04, 2019 7:55 am
by infograf768
TBH, I am not sure I understand all this complexity.
Why don't you simply use the code

Code: Select all

$lang = JFactory::getLanguage()->getTag();

if ($lang == 'es-ES')
{
	//do something
}
elseif ( //etc.)
No idea what is your external file, but you could have one specific external file per language loaded by using the same code in your template or custom extensions.

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Fri Jan 04, 2019 3:35 pm
by Siguana
The PHP code isn¡t important, as it doesn't redirect anywhere. It is just for some culturization purposes.

I only now that the problem is relationated with Language Filter plugin, as the website loads properly if I desactivate it.

As I said before, the website redirects to https://www.site.com/index.php/es/, and it should stop there, instead of coming back to the begining.

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Sat Jan 05, 2019 7:10 am
by infograf768
@Siguana
How can the website load properly when it is set as a multilingual site and the plugin is disabled?
This makes no sense to me.

Imho the problem is due or
1. To your htaccess + your php code
2. To a third party extension interfering with the normal behavior of the plugin.

There is no way we can help as your specific settings can't be reproduced.

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Sat Jan 05, 2019 11:50 am
by Siguana
How can the website load properly when it is set as a multilingual site and the plugin is disabled?
The plugin is enabled! :eek:

Maybe my english language is not good, but I think I didn't say that. I just wanted to say that the website loads properly if I disable the plugin or if I turn on the option for hiding the URL of the language. But I need the website to load properly without turning on the option for hiding the URL of the language.

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Sat Jan 05, 2019 3:47 pm
by imanickam
Following informations would help in assessing the situation to help you out.

(a) What version of Joomla! (e.g., 3.9.1) is being used?

(b) What is your site's URL?

(c) Whether the Language Switcher module is published to the appropriate module position?

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Sat Jan 05, 2019 7:44 pm
by sozzled
@Siguana: I'm not even going to pretend that I understand your problem or that I know the answer(s) but, look at what @infograf768 and @imanickam have written: they don't understand how you have caused your problems (and they're the experts!) and they've asked you to provide more information about your website.

The best way that you can provide information about your website is to use the Forum Post Assistant reporting tool. Good idea, eh? 8)

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Mon Sep 02, 2019 6:54 pm
by hertzli
Hi, Siguana -

I had the exact same problem on a site with English and Danish as languages (as I guess you have English and Spanish). Most pages are in Danish and, hence, URLs have the /da postfix.

The fix to my ERR_TOO_MANY_REDIRECTS was to check https://yoursite.es/administrator/index ... d&client=0

In my case, English was checked as default. When changing the default to Danish, the problem vanished.

... Worth giving it a try...

/Per Hertz
hertzli

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Posted: Wed Jan 15, 2020 10:25 am
by darb
Had same problem and was the setting of the plugin System - Language Filter. Change that and things worked as expected again.