User tests: Successful: Unsuccessful:
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.
/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
.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
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Language & Strings Front End Plugins |
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
I have tested this item ✅ successfully on 6ae36cb
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
PBF
Language Change
Feature
PR-5.1-dev
|
RTC
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.
Status | Ready to Commit | ⇒ | Pending |
Back to pending.
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.
What about a generic fetch/xhr request to index.php?option=com_xxx&...
Fetch / XHR requests do follow redirects automatically.
it works, perfect
Labels |
I have tested this item ✅ successfully on 33d1153
I've tested the following scenarios:
Title |
|
Labels |
Added:
PR-5.2-dev
Removed: PR-5.1-dev |
Category | Administration Language & Strings Front End Plugins | ⇒ | Front End Plugins |
Labels |
Removed:
Language Change
|
Category | Front End Plugins | ⇒ | Administration Language & Strings Front End Plugins |
Labels |
Added:
Language Change
|
Category | Front End Plugins Administration Language & Strings | ⇒ | Front End Plugins |
Labels |
Removed:
Language Change
|
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.
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.
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
RTC
|
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 |
I see what you want to achieve here, but: