-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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.2] SEF: Enforcing correct SEF URL #42854
Conversation
I see what you want to achieve here, but:
|
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. |
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. |
1 similar comment
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. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42854. |
Link to documentation has been added. |
I've played around with this PR using the "testing" dataset in Joomla 5.1.x. I've run into an edge case:
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 |
I agree, this sounds good. I'll add this to the PR. |
I encountered additional issues and will convert this back to draft first. |
Back to pending. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42854. |
What about a generic fetch/xhr request to index.php?option=com_xxx&... |
Fetch / XHR requests do follow redirects automatically. |
it works, perfect This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42854. |
….1-router-sef # Conflicts: # administrator/language/en-GB/plg_system_sef.ini # plugins/system/sef/sef.xml # plugins/system/sef/src/Extension/Sef.php
I have tested this item ✅ successfully on 33d1153
|
Co-authored-by: Quy <[email protected]>
I refactored the PR to use the new option from #43432 to reduce the number of options we add here. |
I have not tested this item. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42854. |
I have tested this item ✅ successfully on 09f8ba3 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. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42854. |
Thanks @Hackwar ! |
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 viaindex.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
/park-blog/first-blog-post
in your site when you use the testing sample data?id=18
to the URL and see that you actually get the "Second Blog Post" displayed instead of the first one./park-blog/second-blog-post
.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