Feature RTC PBF PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
21 Feb 2024

Summary of Changes

Joomla has been improving its SEO performance constantly and one issue which is still open is, that you can reach the same page via different URLs. This means that you can reach the same article both via the wanted URL, but also via the /component/content/article/<id> URL or even via index.php?option=com_content&view=article&catid=<catid>&id=<id>.

This PR adds a new feature which redirects URLs with query parameters to their SEF variant. The router parses the URL and if the original URL contained query parameters, it tries to create a new URL from the information it parsed and if that new URL does not contain any query parameters anymore, it does a redirect to that URL. This will remove a lot of the double URLs for one content item. This only happens for GET requests.

It should be noted, that this does NOT remove every case of duplicate content. For example additional URL parameters are still kept.

I'd like to thank ithelps Digital for sponsoring this feature.

Testing Instructions

  1. Apply the patch
  2. Use some content to test this with, for example the testing sample data.
  3. Go to /park-blog/first-blog-post in your site when you use the testing sample data
  4. Add a ?id=18 to the URL and see that you actually get the "Second Blog Post" displayed instead of the first one.
  5. Enable the option in the SEF plugin.
  6. Reload the frontend page and see that you are redirected to /park-blog/second-blog-post.

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 bembelimen
bembelimen - comment - 22 Feb 2024

I see what you want to achieve here, but:

  • how can a new feature not require documentation (especially such a critical?)
  • the whole feature sounds like it's solved when we implement canonical tags
avatar Hackwar Hackwar - change - 22 Feb 2024
The description was changed
avatar Hackwar Hackwar - edited - 22 Feb 2024
avatar Hackwar Hackwar - edited - 22 Feb 2024
avatar Hackwar
Hackwar - comment - 22 Feb 2024

Sorry about the documentation. It was late yesterday and I will create documentation for the whole SEF thing in the next 48 hours.

Regarding the canonical tag I would disagree. To me, the canonical tag is just a bandaid to get around using the right URL and thus using the right URL in the output is the first step (which we do in Joomla anyway). The second step would then be to redirect wrong URLs to the right ones instead of keeping them and slapping a canonical on there.

avatar ceford ceford - test_item - 23 Feb 2024 - Tested successfully
avatar ceford
ceford - comment - 23 Feb 2024

I have tested this item ✅ successfully on 6ae36cb


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

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

I have tested this item ✅ successfully on 6ae36cb


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

avatar richard67 richard67 - change - 24 Feb 2024
Status Pending Ready to Commit
Labels Added: PBF Language Change Feature PR-5.1-dev
avatar richard67
richard67 - comment - 24 Feb 2024

RTC


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

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 SniperSister
SniperSister - comment - 24 Feb 2024

I've played around with this PR using the "testing" dataset in Joomla 5.1.x.

I've run into an edge case:

  • The testing dataset has an article that isn't accessible via it's own menu item but only via a category list, it's article ID 1, "
    Administrator Components": index.php/content-component/article-category-list/extensions/components/administrator-components
  • If I now open the "Archive Module" menu item (/index.php/content-component/archive-module) and add an extra query parameter to override the article id with the ID 1 (/index.php/content-component/archive-module?id=1) I'm receiving a redirect to this URL: /index.php/content-component/archive-module?view=article&id=1, whereas my expectation would have been a redirect to the category list URL mentioned above.

I'm aware that this is not quirk of the current PR but of the router in general. However, the current PR might increase the effects.

That's why I'm asking myself if we should limit the redirection to "clean" URLs without any leftover query parameters.

Thoughts? @Hackwar

avatar Hackwar
Hackwar - comment - 24 Feb 2024

I agree, this sounds good. I'll add this to the PR.

avatar Hackwar
Hackwar - comment - 24 Feb 2024

I encountered additional issues and will convert this back to draft first.

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

Back to pending.


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

avatar joeforjoomla
joeforjoomla - comment - 24 Feb 2024

What about a generic fetch/xhr request to index.php?option=com_xxx&...
Do you mean that with this option enabled it will no longer be possible to perform a GET request to a raw Joomla URL?
This would be too much generic.

avatar SniperSister
SniperSister - comment - 24 Feb 2024

What about a generic fetch/xhr request to index.php?option=com_xxx&...

Fetch / XHR requests do follow redirects automatically.

avatar miguelvazquez
miguelvazquez - comment - 24 Feb 2024

it works, perfect


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

avatar Hackwar Hackwar - change - 9 Mar 2024
Labels
avatar SniperSister SniperSister - test_item - 13 Mar 2024 - Tested successfully
avatar SniperSister
SniperSister - comment - 13 Mar 2024

I have tested this item ✅ successfully on 33d1153

I've tested the following scenarios:

  • local installation for test dataset, crawled whole site before applying the patch and enabling the feature - after applying the patch, i recrawled the site and got no 404s
  • I've tried various non-sef URL pattern (index.php?Itemid=..., index.php?option=com_users&view=reset&Itemid=...) and got the expected result
  • I've tested the example provided in the test instructions
    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42854.
avatar Hackwar Hackwar - change - 13 Mar 2024
Title
[5.1] SEF: Enforcing correct SEF URL
[5.2] SEF: Enforcing correct SEF URL
avatar Hackwar Hackwar - edited - 13 Mar 2024
avatar Hackwar Hackwar - change - 14 Mar 2024
Labels Added: PR-5.2-dev
Removed: PR-5.1-dev
avatar joomla-cms-bot joomla-cms-bot - change - 6 May 2024
Category Administration Language & Strings Front End Plugins Front End Plugins
avatar Hackwar Hackwar - change - 6 May 2024
Labels Removed: Language Change
avatar joomla-cms-bot joomla-cms-bot - change - 6 May 2024
Category Front End Plugins Administration Language & Strings Front End Plugins
avatar Hackwar Hackwar - change - 11 May 2024
Labels Added: Language Change
avatar joomla-cms-bot joomla-cms-bot - change - 11 May 2024
Category Front End Plugins Administration Language & Strings Front End Plugins
avatar Hackwar Hackwar - change - 11 May 2024
The description was changed
avatar Hackwar Hackwar - edited - 11 May 2024
avatar Hackwar Hackwar - change - 11 May 2024
Labels Removed: Language Change
avatar Hackwar
Hackwar - comment - 11 May 2024

I refactored the PR to use the new option from #43432 to reduce the number of options we add here.

avatar KingLouis1 KingLouis1 - test_item - 15 Jul 2024 - Not tested
avatar KingLouis1
KingLouis1 - comment - 15 Jul 2024

I have not tested this item.

Sorry, i can't reproduce the error with the given instructions. I always be redirectetd to the error 404 page.


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

avatar robbiejackson robbiejackson - test_item - 26 Jul 2024 - Tested successfully
avatar robbiejackson
robbiejackson - comment - 26 Jul 2024

I have tested this item ✅ successfully on 09f8ba3

I tested this using configuration which resulted in a /component/content URL. Then I enabled a menuitem which matched this URL and the code successfully did a 301 redirect to the SEF URL for that menuitem. I repeated this for several cases and they all worked ok.

I also set up a site module which was a list of articles in a given category. The URLs of the articles were based on a category list menuitem, and when I clicked on one of the links it routed me correctly to the article.

I then set up a menuitem pointing directly at the single article and reloaded the site page. It didn't redirect to the new menuitem (as there weren't any query parameters on the URL). But when the module displayed the links it utilised the menuitem for that single article.


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

avatar Hackwar Hackwar - alter_testresult - 15 Aug 2024 - snipersister: Tested successfully
avatar Hackwar Hackwar - change - 15 Aug 2024
Status Pending Ready to Commit
avatar Hackwar
Hackwar - comment - 15 Aug 2024

RTC


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

avatar Quy Quy - change - 15 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 16:26:27
Closed_By pe7er
avatar pe7er pe7er - close - 15 Aug 2024
avatar pe7er pe7er - merge - 15 Aug 2024
avatar pe7er
pe7er - comment - 15 Aug 2024

Thanks @Hackwar !

Add a Comment

Login with GitHub to post a comment