Bug #94499
closedRedirect after slug update doesn't respect suffix
100%
Description
Hello,
in my system i have the routeEnhancers configured with
routeEnhancers:
PageTypeSuffix:
type: PageType
default: '.html'
map:
'.html': 0
my urls are looking like www.domain.com/page.html
when i change the slug from "page" to "page-new" a new redirect is created with
Source Path: /page
Destination: /page-new
i expected that a request to the old address www.domain.com/page.html will redirect to www.domain.com/page-new.html.
but the redirect works only for www.domain.com/page and redirects to www.domain.com/page-new.
so the redirect doesn't work in my case and has no advantages for already indexed urls.
when i change the redirect entry manually to
Source Path: /page.html
Destination: /page-new.html
it works like expected.
Is there a solution or a setting that I am overlooking?
Files
Updated by Martin Tepper over 3 years ago
- File 94499-redirect_without_suffix.diff added
Wrote a very rudimentary patch for this.
But i think there is a better solution to solve it maybe in the urlBuilder. I will check when i have more time.
Updated by Jörg Velletti about 3 years ago
this patch does nearly what it should do.
put is also needed in checkSubPages
protected function checkSubPages(array $currentPageRecord, string $oldSlugOfParentPage, string $newSlugOfParentPage): void
{
$languageUid = (int)$currentPageRecord['sys_language_uid'];
// resolveSubPages needs the page id of the default language
$pageId = $languageUid === 0 ? (int)$currentPageRecord['uid'] : (int)$currentPageRecord['l10n_parent'];
$subPageRecords = $this->resolveSubPages($pageId, $languageUid);
$suffix = $this->getUrlSuffixForPageType();
foreach ($subPageRecords as $subPageRecord) {
$newSlug = $this->updateSlug($subPageRecord, $oldSlugOfParentPage, $newSlugOfParentPage);
if ($newSlug !== null && $this->autoCreateRedirects) {
$this->createRedirect($subPageRecord['slug'] . $suffix , $newSlug . $suffix , $languageUid);
}
}
}
means: add also her a :
$suffix = $this->getUrlSuffixForPageType();
and inside the Foreach loop add two times .$suffix
$this->createRedirect($currentSlug . $suffix, $newSlug . $suffix, languageUid );
Updated by Rémy DANIEL about 3 years ago
- Related to Bug #93483: Redirects: .html page suffix not supported added
Updated by Rémy DANIEL about 3 years ago
- Related to Bug #92101: Redirects: File Extension breaks redirect added
Updated by Rémy DANIEL about 3 years ago
Hi
I think the "urlSuffixForPageType" should not be stored in the record's slug.
The suffix should be either evaluated at the matching time (RedirectService::matchRedirect()
) or added to the cache (RedirectCacheService::getRedirects()
)
Updated by Martin Tepper almost 3 years ago
I'm with you. That would be a better way
Updated by Martin Tepper almost 3 years ago
I'd took a deeper look into an implmentation via RedirectService::matchRedirect() and found some obstacles.
- no siteConfiguration evaluation possible at this point. required to get available suffixes by site
- an implementation at this point would have a negative impact on performance
i'm still with you to evaluate it at the matching time. i don't see a possibility for now.
Do you have an idea?
Updated by Martin Tepper almost 3 years ago
- File deleted (
94499-redirect_without_suffix.diff)
Updated by Martin Tepper almost 3 years ago
added a new version for TYPO3 >= 10.4.22
Updated by Michael Sollmann over 2 years ago
Would be great if this (or another) solution will make it into the core.
Updated by Katharina Strasser over 2 years ago
This seams to be still an issue with 11.5.15
Updated by Oliver Hader about 2 years ago
- Related to Bug #97606: Autocreated redirects ignore PageTypeSuffix (e.g. ".html") added
Updated by Oliver Hader about 2 years ago
- Sprint Focus set to On Location Sprint
Updated by Oliver Hader about 2 years ago
- Related to deleted (Bug #97606: Autocreated redirects ignore PageTypeSuffix (e.g. ".html"))
Updated by Oliver Hader about 2 years ago
- Is duplicate of Bug #97606: Autocreated redirects ignore PageTypeSuffix (e.g. ".html") added
Updated by Oliver Hader about 2 years ago
- Related to deleted (Bug #93483: Redirects: .html page suffix not supported)
Updated by Oliver Hader about 2 years ago
- Is duplicate of Bug #93483: Redirects: .html page suffix not supported added
Updated by Oliver Hader about 2 years ago
- Status changed from Closed to Accepted
Updated by Oliver Hader about 2 years ago
- Related to deleted (Bug #92101: Redirects: File Extension breaks redirect)
Updated by Oliver Hader about 2 years ago
- Has duplicate Bug #92101: Redirects: File Extension breaks redirect added
Updated by Oliver Hader about 2 years ago
- Assignee changed from Oliver Hader to Stefan Bürk
Updated by Gerrit Code Review almost 2 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Stefan Froemken almost 2 years ago
Hello,
I have just uploaded a patch to solve this issue, but I will not move that into the initialization process of TYPO3.
The source path in sys_redirect record has to be an exact match. It's the same way .htaccess does.
It must be possible to have different redirects for:
and
https://example.com/products.html
That's why I have moved the decoration process into the SlugService just before the record will be stored.
Updated by Gerrit Code Review almost 2 years ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 11 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 12 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 13 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 14 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 15 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 16 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 17 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 18 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 19 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 20 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 21 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Stefan Bürk almost 2 years ago
- Related to Feature #99746: Introduce event to manage auto redirect create sources added
Updated by Gerrit Code Review almost 2 years ago
Patch set 22 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 23 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 24 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 25 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 26 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 27 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review almost 2 years ago
Patch set 28 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review over 1 year ago
Patch set 29 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review over 1 year ago
Patch set 30 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Gerrit Code Review over 1 year ago
Patch set 31 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195
Updated by Stefan Bürk over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 238478f5295f652e764124f53d2ce9a68a9a8051.