ERR_TOO_MANY_REDIRECTS in multilingual website

General questions regarding the use of languages in Joomla! 3.x.

Moderators: infograf768, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
Siguana
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Wed Aug 24, 2016 1:35 pm

ERR_TOO_MANY_REDIRECTS in multilingual website

Post by Siguana » Thu Jan 03, 2019 5:53 pm

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?
Last edited by toivo on Thu Jan 03, 2019 6:55 pm, edited 1 time in total.
Reason: mod note: moved to 3.x Language

User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 19678
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ UK/ S'pore/Jakarta/ North America
Contact:

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by leolam » 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)
Joomla's #1 Professional Support Provider:
-> Joomla Professional Support: https://gws-desk.com -
-> Joomla Specialized Hosting Solutions: https://gws-host.com -
-> Joomla Webmaster Services: gws-webmaster.services

Siguana
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Wed Aug 24, 2016 1:35 pm

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by Siguana » Thu Jan 03, 2019 6:14 pm

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";
		}
	}

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11343
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by toivo » Thu Jan 03, 2019 7:04 pm

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?
Toivo Talikka, Global Moderator

Siguana
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Wed Aug 24, 2016 1:35 pm

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by Siguana » Thu Jan 03, 2019 7:17 pm

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...

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18872
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by infograf768 » Fri Jan 04, 2019 7:55 am

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.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

Siguana
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Wed Aug 24, 2016 1:35 pm

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by Siguana » Fri Jan 04, 2019 3:35 pm

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.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18872
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by infograf768 » Sat Jan 05, 2019 7:10 am

@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.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

Siguana
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Wed Aug 24, 2016 1:35 pm

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by Siguana » Sat Jan 05, 2019 11:50 am

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.

User avatar
imanickam
Joomla! Master
Joomla! Master
Posts: 27270
Joined: Wed Aug 13, 2008 2:57 am
Location: Chennai, India

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by imanickam » Sat Jan 05, 2019 3:47 pm

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?
Ilagnayeru (MIG) Manickam | இளஞாயிறு மாணிக்கம்
Joomla! - Global Moderators Team | Translations Coordination Team | Tamil (தமிழ்) Translation Team

Eegan - Support the poor and underprivileged

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 7875
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by sozzled » Sat Jan 05, 2019 7:44 pm

@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)
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

hertzli
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Sep 02, 2019 6:43 pm

Re: ERR_TOO_MANY_REDIRECTS in multilingual website

Post by hertzli » Mon Sep 02, 2019 6:54 pm

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


Post Reply

Return to “Language - Joomla! 3.x”