Feature No Code Attached Yet
avatar lipatovroman
lipatovroman
7 Sep 2023

Hello.
For example, we have 6 languages on the site.
Default language is English.
When we are on Spanish site version (site.com/es/), alternate URLs looks ok:

<link href="https://site.com/" rel="alternate" hreflang="en-GB">
<link href="https://site.com/fr/" rel="alternate" hreflang="fr-FR">
<link href="https://site.com/de/" rel="alternate" hreflang="de-DE">

Note the URL of the English version of the site.
It does not contain the language in the URL.

But language module contain another URL to default language.
<a href="/en/"> English </a>
And this URL have 301 redirect to site.com

Google Search Console displays a warning about thousands of pages with 301 redirects.
I tried to replace language from the URL with code:

<?php
$no301 = str_replace("/en/", "", $language->link);
?>

And it's working.
But if we are on the home page of any language other than English, it is impossible to switch to the English version.

It has long been known that internal 301 redirects are bad for SEO and are considered a technical problem that should be fixed.

avatar lipatovroman lipatovroman - open - 7 Sep 2023
avatar lipatovroman lipatovroman - change - 7 Sep 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 7 Sep 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Sep 2023
avatar lipatovroman lipatovroman - change - 7 Sep 2023
The description was changed
avatar lipatovroman lipatovroman - edited - 7 Sep 2023
avatar brianteeman
brianteeman - comment - 7 Sep 2023

image

avatar lipatovroman
lipatovroman - comment - 7 Sep 2023

I tried this option.
No matter if it enabled or disabled.
Language module always displays URL site.com/en/ instead of site.com


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41634.

avatar brianteeman
brianteeman - comment - 7 Sep 2023

and when it is disabled then all languages will display /langcode/ and trhere is no redirect?

avatar lipatovroman
lipatovroman - comment - 7 Sep 2023

Exactly.
When it's disabled, all URLs contains /en/ for default language.
And when we're switching from another language's - no any redirects.
site.com/es/ to site.com/en/ = 200

When it's enabled:
site.com/es/ to site.com/en/ = 301 to site.com

In the same time, alternate links are correct:

<link href="https://site.com/" rel="alternate" hreflang="en-GB">
<link href="https://site.com/fr/" rel="alternate" hreflang="fr-FR">
<link href="https://site.com/de/" rel="alternate" hreflang="de-DE">

This creates a huge number of 301 redirects, especially on large sites.
And this is a very serious problem for SEO.

avatar brianteeman
brianteeman - comment - 7 Sep 2023

so dont enable it and the problem is solved?

avatar lipatovroman
lipatovroman - comment - 7 Sep 2023

so dont enable it and the problem is solved?

Of course no )))

At first, it's a serious bug. It should be fixed.

I'm sure many webmasters with multi-language sites don't even know about this problem.
Personally, I found out about it by accident 2 years later when Google sent me an email saying there were problems with the site that needed to be fixed, a large number of redirects.

Next, in my case. I have a very big site, which already indexed by all search engines.
And now English site version have URLs like
https://directory.audio
https://directory.audio/sound-effects
https://directory.audio/free-music

If I disable this option, thousands pages will be redirected back, from
https://directory.audio/free-music to https://directory.audio/en/free-music

avatar Hackwar Hackwar - change - 28 Mar 2024
Labels Added: Feature
avatar Hackwar Hackwar - labeled - 28 Mar 2024
avatar Hackwar
Hackwar - comment - 28 Mar 2024

Yes, the behavior of Joomla is strange here. It is how it has been working for a decade or longer now. I wouldn't exactly call this a bug, but indeed it should be looked at if we change this behavior and improve it, making this a feature.

avatar nikosfa
nikosfa - comment - 11 Feb 2025

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.

avatar Kycb27
Kycb27 - comment - 12 Feb 2025

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.

I changed the module a little, maybe my solution will help:
/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);
   }
}
avatar Hackwar
Hackwar - comment - 12 Feb 2025

Or you could simply test PR #43858, which would fix this and has been waiting for 7 months now.

avatar Hackwar Hackwar - change - 12 Feb 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-02-12 10:06:53
Closed_By Hackwar
avatar Hackwar Hackwar - close - 12 Feb 2025
avatar Hackwar
Hackwar - comment - 12 Feb 2025

Since we have PR #43858 which fixes this, I'm closing this issue. Please test the PR, otherwise this will never be solved.

Add a Comment

Login with GitHub to post a comment