-Create a menu item with the alias about-joomla and ID 153.
-Ensure that SEF URLs are enabled in the Joomla Global Configuration.
-Verify that the SEF URL works correctly: https://www.joomla.org/about-joomla.html
-Now, try accessing the non-SEF URL directly: https://www.joomla.org/index.php?Itemid=153
-Observe that this URL does not get converted into its SEF equivalent.
-Enable the "System - SEF" plugin.
-Check the tag for https://www.joomla.org/index.php?Itemid=153.
-When accessing https://www.joomla.org/index.php?Itemid=153, Joomla should automatically redirect to the SEF URL https://www.joomla.org/about-joomla.html.
-The canonical tag should point to the SEF URL, not the non-SEF URL. (very important)
-The non-SEF URL does not get rewritten to its SEF equivalent.
-The canonical tag incorrectly points to https://www.joomla.org/index.php?Itemid=153 instead of https://www.joomla.org/about-joomla.html.
Joomla version: 5.2.5
PHP version: 8.3
SEF URLs: Enabled
"System - SEF" plugin: Enabled
| Labels |
Added:
No Code Attached Yet
|
||
any updates?
I don't want to play this game yet again: No, there is no canonical URL in Joomla. You messed up your installation by filling out the field in the SEF plugin without knowing what that field does. Clear that field. Joomla only redirects to the SEF URL if it can convert all query parts to a path equivalent and also only when you have strict routing enabled.
@Hackwar Okay, Thank you for the clarification. I have ensured that the "Canonical URL" field in the SEF plugin now is empty and that strict routing is enabled. However, the issue persists:
1- Joomla does not redirect index.php?Itemid=xxx to the SEF URL.
2- Now The canonical tag points to as Alternative TAG in all Pages!!
.
The tag behavior is correct that way.
If you ignore the "canonical" issue for a moment: I have the same problem that every page exists with two URLs in Joomla (everything else I eliminated with the SEF-plugin etc.).
So I too see, that every
https://www.example.com/example (= "SEF-URL")
can also be accessed by (= exists as a duplicate):
https://www.example.com/?itemid=xxx (= an unwanted duplicate, caused by the "menu")
And when https://www.example.com/?itemid=xxx gets opened, there is no redirect to https://www.example.com/example
Also with "strict redirection" (SEF-plugin) on etc. there is no redirect to the SEF URL, which should be the case, as everything else indicate it would result in that.
Is there any solution to this??
The strict routing parameter is enforcing the system to not fallback to the homepage menu item. See PR #42989.
The corresponding code in Joomla\CMS\Component\Router\Rules\MenuRules::preprocess() says that this is removed in Joomla 6, which seems to not have happened.
@Hackwar Should we change the description in the SEF Plugin, such that it refelcts the different behavior regarding the Itemid in the SEF URL?
The current description focuses on duplicate URL handling and redirects, but does not mention that Strict Routing also disables fallback Itemid assignment during link generation, which directly affects SEF URLs even when no redirect occurs.
Here a recomendation, on how the description could be changed to such that it reflects the whole behavior:
Enforce canonical SEF URLs (301 redirects) and prevent fallback menu guessing when generating links. Without a matching menu item, Joomla won’t auto-assign an Itemid.
There is no such thing in Joomla as a canonical tag for a url