We have multilingual site.
We configured the default language (English).
In Language Filter plugin configured Remove URL Language Code = Yes.
So, now we on main page and alternate languages displays correct. English version of the link does not have prefix /en/.
But Language switcher module contains the prefix /en/
Yes, when we select default English language, we'll get 301 redirect to the URL without prefix.
But it happens for all site URLs.
So, my site have 20K items and hundreds categories and 5 additional languages.
It means, that we're getting more than 100K 301 redirects just because module have not correct link to the default language page.
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
?
|
@lipatovroman as of your first screeshot: URL
for default lang
does not include lang
prefix because default language is mapped to site root
(/
). See .htaccess file
@lipatovroman as of your first screeshot:
URL
for defaultlang
does not includelang
prefix because default language is mapped tosite root
(/
). See .htaccess file
I'm talking about link from the module. It's mapped to the site.com/en/ and then redirects to domain root.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-04-07 12:21:12 |
Closed_By | ⇒ | Hackwar | |
Labels |
Added:
Feature
Removed: ? |
You reported this again as #41634. Since these are duplicate reports, I'm closing this one.
All my reports and all reports from other users were closed.
Problem not solved.
Someone wrote, that it's not a bug, it's a feature.
If this is a feature, so how to disable it?
I don't need thousands of 301 redirects on my site.
Google Search Console sends me alerts, that my site have too much 301 redirects.
Why alternate URLs are different with URLs from language module?
So, again. If it's a feature (strange, bad feature) - we should have ability to disable it.
Same problem in Joomla 5.
Has someone found the solution?
There should be a fix in this module, since this IS real problem for all Joomla sites, since this "feature" has very bad SEO consequences in multilingual sites.
Та же проблема в Joomla 5. Кто-нибудь нашел решение? Должно быть исправление в этом модуле, так как это РЕАЛЬНАЯ проблема для всех сайтов Joomla, так как эта "фича" имеет очень плохие последствия для SEO на многоязычных сайтах.
I changed the module a little, maybe my solution will help:
src/modules/mod_languages/src/Helper/LanguagesHelper.php
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Plugin\PluginHelper;
$default_lang = ComponentHelper::getParams('com_languages')->get('site', 'en-GB');
$plugin = PluginHelper::getPlugin('system', 'languagefilter');
$pluginParams = json_decode($plugin->params);
if ($multilang) {
...
if ($pluginParams->remove_default_prefix && $language->lang_code === $default_lang) {
$language->link= preg_replace('|/' . $language->sef . '/|', '/', $language->link, 1);
}
}
That has been reported in past several times, see e.g. issues #26480 and #23144 , and several attempts to fix it have failed, see e.g. #23178 and #28265 , so the issues had been closed as expected behaviour. That's why I label this issue not as a bug but as a new feature.