Feature RTC Language Change PBF PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
21 Feb 2024

Pull Request for Issue #15025 .

Summary of Changes

Joomla has been improving its SEO performance constantly and one issue which is still open is the behavior of the suffix. Right now, you can access a URL in Joomla with or without suffix when the option is enabled in the global configuration. This PR introduces a new setting the SEF system plugin which enforces a consistent suffix behavior.

When SEF URLs are enabled, the suffix is enabled and this option is enabled, Joomla will always redirect GET requests to a URL with a suffix if none is present. It will also redirect URLs with a query format parameter to the nicer URL and replace the "nice" suffix with the format parameter if the two collide.

With Joomla 6.0 the option to switch this on/off should be removed again and this should be the default behavior, which would then be added to SiteRouter::parseFormat(). Right now this is YASO (Yet Another Stupid Option) to allow people to test this in live systems and to switch it off if we encounter unforseen issues. The time from 5.1 to 6.0 could be seen as a grace period.

This PR depends on #42692.

I'd like to thank djumla GmbH for sponsoring this feature.

Testing Instructions

  1. Make sure that you have PR #42692 in your test installation
  2. Apply the patch
  3. Enable SEF URLs and the "Add Suffix to URL" options in global configuration
  4. Go to "System - SEF" plugin and enable the option to "Enforce Suffix"
  5. Open a URL in the frontend and see that URLs ending in a / don't have a suffix, everything else has a suffix.
  6. Take a URL with a suffix and remove the suffix. See that Joomla redirects back to a URL with .html.
  7. Take a URL with a suffix and add ?format=feed to it, for example for a category blog view. See that you get the feed output with the right URL.

Link to documentations

Please select:

avatar Hackwar Hackwar - open - 21 Feb 2024
avatar Hackwar Hackwar - change - 21 Feb 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 Feb 2024
Category Administration Language & Strings Front End Plugins
avatar brianteeman
brianteeman - comment - 21 Feb 2024

This looks like it addresses a 7 year old bug #15025

avatar Hackwar Hackwar - change - 21 Feb 2024
Labels Added: Feature PBF
avatar ceford ceford - test_item - 23 Feb 2024 - Tested successfully
avatar ceford
ceford - comment - 23 Feb 2024

I have tested this item ✅ successfully on 784cfda


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

avatar nielsnuebel nielsnuebel - test_item - 24 Feb 2024 - Tested successfully
avatar nielsnuebel
nielsnuebel - comment - 24 Feb 2024

I have tested this item ✅ successfully on 784cfda


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

avatar viocassel viocassel - test_item - 24 Feb 2024 - Tested successfully
avatar viocassel
viocassel - comment - 24 Feb 2024

I have tested this item ✅ successfully on 784cfda


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

avatar richard67 richard67 - change - 24 Feb 2024
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 24 Feb 2024

RTC


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

avatar brianteeman
brianteeman - comment - 24 Feb 2024

In favour of the bug fix. Not in favour of the option. As such this should be in 4.4 as a bug fix and not as a new feature in a future release

avatar Hackwar Hackwar - change - 24 Feb 2024
The description was changed
avatar Hackwar Hackwar - edited - 24 Feb 2024
avatar Hackwar
Hackwar - comment - 24 Feb 2024

Link to documentation has been added.

avatar Hackwar
Hackwar - comment - 24 Feb 2024

This is a change in behavior and not just a bugfix. That's why we wont get around this option. For Joomla 6.0 this option will be removed again and the behavior added to the normal behavior of the Add Suffix to URL option. So as long as we will stick to semantic versioning we will have to add this as an option.

avatar Nuyonuyonoina
Nuyonuyonoina - comment - 24 Feb 2024

Failed. Too bad, because it's a strong request from a client of mine and for that reason SEO agency it's working with ask to migrate to another CMS...

avatar Hackwar
Hackwar - comment - 24 Feb 2024

@Nuyonuyonoina could you comment what is failing on your end? Otherwise I can't fix that and this PR wont be merged.

avatar webfeuerflo
webfeuerflo - comment - 24 Feb 2024

failed. followed the instructions, but if I remove .html from the URL it does not get added back

avatar webfeuerflo webfeuerflo - test_item - 24 Feb 2024 - Tested unsuccessfully
avatar webfeuerflo
webfeuerflo - comment - 24 Feb 2024

I have tested this item ? unsuccessfully on 784cfda

failed. followed the instructions, but if I remove .html from the URL it does not get added back


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

avatar webfeuerflo
webfeuerflo - comment - 24 Feb 2024

Tested on PHP 8.1.27, 10.4.32-MariaDB, Joomla! 5.1.0-alpha4 Alpha [ Kudumisha ] 20-February-2024 16:31 GMT


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

avatar webfeuerflo
webfeuerflo - comment - 24 Feb 2024

the pages can now be accessed with 3 URLs: with .html with / and without /. All show the same article


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42850.
avatar Hackwar
Hackwar - comment - 24 Feb 2024

Did you apply the PR #42692 as well?

avatar webfeuerflo
webfeuerflo - comment - 24 Feb 2024

yes, both patches are installed and active in the patchtester

avatar webfeuerflo
webfeuerflo - comment - 24 Feb 2024

Found out, why it failed! I had yootheme installed, although not set as standard template, the framework is doing something that interferes with this patch. When I deactivate all yootheme extensions, the patch works


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42850.
avatar webfeuerflo
webfeuerflo - comment - 24 Feb 2024

@saschadube the yootheme system plugin is keeping this patch from working. Any idea what is going on?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42850.
avatar Hackwar
Hackwar - comment - 24 Feb 2024

My assumption would be that they are creating the router object so early in the process that no other plugin is able to run and thus these new options can't attach themselfs to the router. To be honest, this is something Yootheme needs to fix.

avatar richard67 richard67 - alter_testresult - 25 Feb 2024 - webfeuerflo: Not tested
avatar richard67
richard67 - comment - 25 Feb 2024

I've unset @webfeuerflo 's negative test result as it has turned out that it was not caused by this PR but by a 3rd party plugin.

avatar janschoenherr
janschoenherr - comment - 26 Feb 2024

Thanks, the next YOOtheme Pro version will resolve the problem with booting com_media and by that creating the SiteRouter too early. ?

avatar bembelimen
bembelimen - comment - 28 Feb 2024

Hello @Hackwar ,

today in the maintainer meeting we decided, that we would really like to have this function in core but there shouldn't be two parameters (one in the global configuration and one on the plugin). Could you merge them, so we have only one parameter in the global configuration and no in the SEF plugin? (so remove the xml + line 74 in the "if".

avatar Hackwar Hackwar - change - 28 Feb 2024
Labels Added: RTC Language Change PR-5.1-dev
avatar Hackwar
Hackwar - comment - 29 Feb 2024

I'm sorry, but in that case I rather pull this PR back and not have this in 5.1. I'm not going to take the chances of sites breaking because this is enabled by default. There are way to many sites out there which have weird code to just take the chance on this.

avatar Fedik
Fedik - comment - 29 Feb 2024

I have noticed to late.

Can you please do not do redirect in parseRule?
The rule should do "rule thing", nothing more.
The same problem with #42702 (that already merged and should be also fixed)

I not very concerned about extra Option, however the redirect is a bigger issue.

avatar bembelimen bembelimen - change - 1 Mar 2024
Status Ready to Commit Pending
avatar bembelimen
bembelimen - comment - 1 Mar 2024

Revert as it's a draft.


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

avatar Hackwar Hackwar - change - 6 Mar 2024
Labels Removed: RTC
avatar Hackwar Hackwar - change - 6 Mar 2024
Title
[5.1] SEF: Enforce suffix
[5.2] SEF: Enforce suffix
avatar Hackwar Hackwar - edited - 6 Mar 2024
avatar joomla-cms-bot joomla-cms-bot - change - 6 Mar 2024
Category Administration Language & Strings Front End Plugins Administration com_admin com_associations com_banners com_cache com_categories com_checkin com_config
avatar Hackwar
Hackwar - comment - 6 Mar 2024

In the CMS maintainer meeting we talked about this again and the team agreed to the current implementation. Since it is to late for 5.1, I rebased this to 5.2, but 5.2 is in a desperate need of an upmerge... Anyway, this is theoretically ready to test.

avatar Hackwar Hackwar - change - 23 Mar 2024
Labels Added: PR-5.2-dev
Removed: Language Change PR-5.1-dev
avatar joomla-cms-bot joomla-cms-bot - change - 23 Mar 2024
Category Administration com_admin com_associations com_banners com_cache com_categories com_checkin com_config Administration Language & Strings Front End Plugins
avatar Hackwar Hackwar - change - 1 Jun 2024
Labels Added: Language Change
avatar Hackwar
Hackwar - comment - 1 Jun 2024

Thank you, @SniperSister, I fixed that. @ceford, @nielsnuebel, @viocassel and of course anybody else who is intersted, would you be so kind to test this again, so that we can merge this for 5.2?

avatar ceford ceford - test_item - 2 Jun 2024 - Tested successfully
avatar ceford
ceford - comment - 2 Jun 2024

I have tested this item ✅ successfully on 5900b39

I see #42692 has been merged. I am using a cms clone - so I did a git pull them npm ci, applied the patch and I get this:

An error has occurred.

0 Call to undefined method Joomla\Plugin\System\Sef\Extension\Sef::setSiteRouter() 

I needed to disable the sef plugin in the database to get admin working again.


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

avatar ceford ceford - test_item - 2 Jun 2024 - Tested unsuccessfully
avatar ceford
ceford - comment - 2 Jun 2024

I have tested this item ? unsuccessfully on 5900b39

I see #42692 has been merged. I am using a cms clone - so I did a git pull them npm ci, applied the patch and I get this:

An error has occurred.

0 Call to undefined method Joomla\Plugin\System\Sef\Extension\Sef::setSiteRouter() 

I needed to disable the sef plugin in the database to get admin working again.


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

avatar Hackwar Hackwar - change - 2 Jun 2024
The description was changed
avatar Hackwar Hackwar - edited - 2 Jun 2024
avatar Hackwar
Hackwar - comment - 2 Jun 2024

@ceford The comment about #42692 actually isn't true anymore and that PR actually has been reverted before the release of 5.1. Since this PR also doesn't touch that code, your git clone most likely is very outdated and should be updated to latest 5.2-dev before testing this.

avatar ceford
ceford - comment - 3 Jun 2024

My clone is up to date. I checked out 5.2-dev - title bar shows ‎5.2.0-alpha1-dev

The SEF plugin is enabled. I apply the patch and then all menu items in the back end give:

     0 Call to undefined method Joomla\Plugin\System\Sef\Extension\Sef::setSiteRouter() 

Call Stack
# 	Function 	Location
1 	() 	JROOT/plugins/system/sef/services/provider.php:42
2 	Joomla\DI\ServiceProviderInterface@anonymous/Users/ceford/Sites/joomla-cms5/plugins/system/sef/services/provider.php:22$97->{closure}() 	JROOT/libraries/vendor/joomla/di/src/ContainerResource.php:172
3 	Joomla\DI\ContainerResource->getInstance() 	JROOT/libraries/vendor/joomla/di/src/Container.php:95
4 	Joomla\DI\Container->get() 	JROOT/libraries/src/Extension/ExtensionManagerTrait.php:177
5 	Joomla\CMS\Application\CMSApplication->loadExtension() 	JROOT/libraries/src/Extension/ExtensionManagerTrait.php:99
6 	Joomla\CMS\Application\CMSApplication->bootPlugin() 	JROOT/libraries/src/Plugin/PluginHelper.php:232
7 	Joomla\CMS\Plugin\PluginHelper::import() 	JROOT/libraries/src/Plugin/PluginHelper.php:192
8 	Joomla\CMS\Plugin\PluginHelper::importPlugin() 	JROOT/libraries/src/Application/CMSApplication.php:765 

So I have to disable the plugin so I can revert the patch. It may be my installation that is the problem but I don't know what to do about it.


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

avatar SniperSister SniperSister - test_item - 21 Jul 2024 - Tested successfully
avatar SniperSister
SniperSister - comment - 21 Jul 2024

I have tested this item ✅ successfully on ef8201e


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

avatar webnet-assmann webnet-assmann - test_item - 23 Jul 2024 - Tested successfully
avatar webnet-assmann
webnet-assmann - comment - 23 Jul 2024

I have tested this item ✅ successfully on ef8201e


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

avatar Hackwar Hackwar - change - 23 Jul 2024
Status Pending Ready to Commit
avatar robbiejackson robbiejackson - test_item - 27 Jul 2024 - Tested successfully
avatar robbiejackson
robbiejackson - comment - 27 Jul 2024

I have tested this item ✅ successfully on ef8201e

I tested this by just patching the changed files into my 5.1 instance.

I confirmed that with the global config set then the html prefix is restored after you remove it manually.

I also confirmed that an xml feed document was returned correctly whenever a prefix of .feed or a query parameter of format=feed was set in the URL.


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

avatar bembelimen
bembelimen - comment - 8 Aug 2024

@ceford could you please check if the problem still exists?

avatar bembelimen bembelimen - change - 8 Aug 2024
Labels Added: RTC
avatar pe7er pe7er - change - 15 Aug 2024
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-08-15 20:58:08
Closed_By pe7er
avatar pe7er pe7er - close - 15 Aug 2024
avatar pe7er pe7er - merge - 15 Aug 2024
avatar pe7er
pe7er - comment - 16 Aug 2024

Thanks @Hackwar !

Add a Comment

Login with GitHub to post a comment