New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.1] SEF: Implementing trailing slash behavior #42702
Conversation
|
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. |
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. |
|
Did you read that this PR depends on #42692 ? |
no I didnt see that |
I have not tested this item. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42702. |
….1-router-trailing
…nto 5.1-router-trailing # Conflicts: # plugins/system/sef/src/Extension/Sef.php
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. |
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. |
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. |
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? |
Back to pending This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42702. |
Back to pending as there have been made changes. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42702. |
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. |
1 similar comment
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. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42702. |
Link to documentation has been added. |
Thank you @Hackwar and for testing and support @SniperSister @viocassel @richard67 |
Thank you! |
Thank you very much for this @Hackwar ! I'm glad it didn't get dismissed. my 2c on the importance: tl;dr: 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. |
You're welcome. ;-) |
Thank you Hackwar for bringing this finally into the joomla core! :-) |
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 |
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
$uri->setPath($uri->getPath() . '/' . $tmp . '/');
Link to documentations
Please select:
Documentation link for docs.joomla.org: https://docs.joomla.org/Search_Engine_Friendly_URLs
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed