RTC Language Change PR-5.1-dev Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
23 Jan 2024

Summary of Changes

Joomla has been improving its SEO performance constantly and one issue which is still open is the behavior of trailing slashes in URLs. Right now, Joomla has largely been following a no-trailing-slashes policy, however we never enforced this. At the same time, some SEO people wanted to have trailing slashes on all URLs. This PR introduces this feature.

This introduces 2 new settings in the SEF system plugin. The first setting lets you decide if you want to have a trailing slash, no trailing slash or no special behavior (which is the b/c setting). Depending on the setting, it either adds or removes all trailing slashes.

The second setting is available when one of the former options is set and redirects a GET request with missing or trailing slash to the "correct" URL with a 301 depending on the other option.

This PR depends on #42692.

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

Testing Instructions

  1. Apply the PR
  2. Check that no URLs changed
  3. Edit libraries/src/Router/SiteRouter.php and change line 466 to $uri->setPath($uri->getPath() . '/' . $tmp . '/');
  4. See that all URLs now contain a trailing slash.
  5. Go to the SEF system plugin in the backend and set the setting to remove the trailing slash.
  6. See that all URLs now don't contain a trailing slash.
  7. Revert the change from step 3.
  8. Change the setting in the SEF plugin to always add a trailing slash.
  9. See that all URLs now contain a traling slash again.
  10. Set the second option to enforce the behavior with a 301 redirect.
  11. Go to the frontend again and either add or remove the trailing slash, depending on your setting, in your browser bar.
  12. See that Joomla redirected you to the same page with the correct URL again.

Link to documentations

Please select:

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar Hackwar Hackwar - open - 23 Jan 2024
avatar Hackwar Hackwar - change - 23 Jan 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Jan 2024
Category Administration Language & Strings Front End Plugins
avatar Hackwar Hackwar - change - 23 Jan 2024
Labels Added: Language Change PR-5.1-dev
avatar Hackwar Hackwar - change - 23 Jan 2024
The description was changed
avatar Hackwar Hackwar - edited - 23 Jan 2024
avatar brianteeman
brianteeman - comment - 23 Jan 2024
  1. Instead of adding another option which a large % of users will never use why not simply do this in the htaccess.
    2. the description is confusing "Remove unneeded index.php from URLs" because it sounds the same as the existing option which removes index.php
  2. If accepted dont you need to update the installation and the configuration.php.dist
  3. What happened to the requirement for all new "features" to be accompanied with documentation
avatar Hackwar
Hackwar - comment - 23 Jan 2024

To 1.: it is a difference if we output wrong URLs and then redirect in the htaccess or do it correct right away. Yes, the redirect could be done in the htaccess, but that requires error prone actions from the user, while this here is the simpler solution.

To 2.: no, since these options are not stored in the configuration.php.

To 3.: the PR is not merged yet, is it. ? Documentation is on its way and will be combined with the other 2 router related PRs.

avatar brianteeman brianteeman - test_item - 23 Jan 2024 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 23 Jan 2024

I have tested this item ? unsuccessfully on 131eafe


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

avatar brianteeman
brianteeman - comment - 23 Jan 2024

Tested with both of the following

In both cases with the sample joomla data I observed no trailing slash in the url

avatar Hackwar
Hackwar - comment - 23 Jan 2024

Did you read that this PR depends on #42692 ?

avatar brianteeman
brianteeman - comment - 23 Jan 2024

no I didnt see that

avatar brianteeman brianteeman - test_item - 23 Jan 2024 - Not tested
avatar brianteeman
brianteeman - comment - 23 Jan 2024

I have not tested this item.


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

avatar SniperSister SniperSister - test_item - 13 Feb 2024 - Tested successfully
avatar SniperSister
SniperSister - comment - 13 Feb 2024

I have tested this item ✅ successfully on d49ccdf

Work as described!


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

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

I have tested this item ✅ successfully on d49ccdf


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

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

Setting RTC as it has 2 good tests, but setting also the RMDG (release manager decision queue) label because this PR is subject of discussion among maintainers.


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

avatar Hackwar Hackwar - change - 14 Feb 2024
Labels Added: RTC RMDQ
avatar Hackwar
Hackwar - comment - 14 Feb 2024

In the CMS Maintainer meeting we talked about this PR and decided to join the two options into one. So if you decide for one behavior, it automatically also means when the URL is not as expected, it does a redirect to the right one. I made the necessary changes. @SniperSister and @viocassel would you be able to test this again?

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

Back to pending


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

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

I have tested this item ✅ successfully on baac8cd


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

avatar SniperSister SniperSister - test_item - 17 Feb 2024 - Tested successfully
avatar SniperSister
SniperSister - comment - 17 Feb 2024

I have tested this item ✅ successfully on baac8cd


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

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

RTC


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

avatar Hackwar Hackwar - change - 19 Feb 2024
Labels Removed: RMDQ
avatar richard67 richard67 - change - 19 Feb 2024
Status Ready to Commit Pending
avatar richard67
richard67 - comment - 19 Feb 2024

Back to pending as the PR has received a change. @SniperSister @viocassel Could you test again? Thanks in advance.


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

avatar SniperSister SniperSister - test_item - 19 Feb 2024 - Tested successfully
avatar SniperSister
SniperSister - comment - 19 Feb 2024

I have tested this item ✅ successfully on a9f1b3c

Works as expected and fixes the issue caught by Martina


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

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

I have tested this item ✅ successfully on a9f1b3c

?


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

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

RTC


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

avatar brianteeman
brianteeman - comment - 20 Feb 2024

This should be retested as there has been a change

avatar Hackwar
Hackwar - comment - 20 Feb 2024

After some discussions, we decided to switch this to use 301 redirects instead of 303s.

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

Back to pending as there have been made changes.
@SniperSister @viocassel Could you test again? Thanks in advance.


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

avatar SniperSister SniperSister - test_item - 20 Feb 2024 - Tested successfully
avatar SniperSister
SniperSister - comment - 20 Feb 2024

I have tested this item ✅ successfully on 74383a3


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

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

I have tested this item ✅ successfully on 74383a3


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

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

RTC


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

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 LadySolveig LadySolveig - close - 28 Feb 2024
avatar LadySolveig LadySolveig - merge - 28 Feb 2024
avatar LadySolveig LadySolveig - change - 28 Feb 2024
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-02-28 17:39:57
Closed_By LadySolveig
avatar LadySolveig
LadySolveig - comment - 28 Feb 2024

Thank you @Hackwar and for testing and support @SniperSister @viocassel @richard67

avatar Hackwar
Hackwar - comment - 28 Feb 2024

Thank you!

avatar pAnd0rASBG
pAnd0rASBG - comment - 11 Apr 2024

Thank you very much for this @Hackwar ! I'm glad it didn't get dismissed.

my 2c on the importance:
according to Google's Martin Splitt, who I had a conversation with on this topic late last year, this still counts: https://developers.google.com/search/blog/2010/04/to-slash-or-not-to-slash?hl=en

tl;dr:
Trailing slashes do matter to Google. Traditionally that comes from url w/ trailing slash being seen as directory and url w/o trailing slash as file. Google respects same urls with and without trailing slashes to have different content, even.
On the other hand, if e.g. https://mysite.com/blog and https://mysite.com/blog/ show the same content, Google may punish you for duplicate content and even if that's not the case, your "Link Juice" will be split 50/50, so instead of getting one better ranked entry in the SERPs, you get 2 worse.

So even if a large % of users will not actively use it, if there is a default behaviour for either with or without trailing slash, still all users will profit from the SEO impact.


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

avatar Hackwar
Hackwar - comment - 11 Apr 2024

You're welcome. ;-)

avatar rfmjoe
rfmjoe - comment - 11 Apr 2024

Thank you Hackwar for bringing this finally into the joomla core! :-)

avatar brbrbr
brbrbr - comment - 16 Apr 2024

Are you sure the slashes are working in the attachBuildRule part? Appears to be a bit of number bonanza on the trailingslash param: 1 and 2 in onAfterInitialise 0 and 1 in enforceTrailingSlash

avatar SniperSister
SniperSister - comment - 17 Apr 2024

Add a Comment

Login with GitHub to post a comment