Project

General

Profile

Actions

Bug #94499

closed

Redirect after slug update doesn't respect suffix

Added by Martin Tepper over 3 years ago. Updated 4 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Site Handling, Site Sets & Routing
Target version:
-
Start date:
2021-07-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
On Location Sprint

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


Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Feature #99746: Introduce event to manage auto redirect create sourcesClosedStefan Bürk2023-01-30

Actions
Is duplicate of TYPO3 Core - Bug #97606: Autocreated redirects ignore PageTypeSuffix (e.g. ".html")Closed2022-05-11

Actions
Is duplicate of TYPO3 Core - Bug #93483: Redirects: .html page suffix not supportedClosed2021-02-10

Actions
Has duplicate TYPO3 Core - Bug #92101: Redirects: File Extension breaks redirectClosed2020-08-26

Actions
Actions #1

Updated by Michael Sollmann over 3 years ago

Can confirm this!

Actions #2

Updated by Martin Tepper about 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.

Actions #3

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 );
Actions #4

Updated by Rémy DANIEL almost 3 years ago

  • Related to Bug #93483: Redirects: .html page suffix not supported added
Actions #5

Updated by Rémy DANIEL almost 3 years ago

  • Related to Bug #92101: Redirects: File Extension breaks redirect added
Actions #6

Updated by Rémy DANIEL almost 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())

Actions #7

Updated by Martin Tepper almost 3 years ago

I'm with you. That would be a better way

Actions #8

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?

Actions #9

Updated by Martin Tepper almost 3 years ago

  • File deleted (94499-redirect_without_suffix.diff)
Actions #10

Updated by Martin Tepper almost 3 years ago

added a new version for TYPO3 >= 10.4.22

Actions #11

Updated by Michael Sollmann over 2 years ago

Would be great if this (or another) solution will make it into the core.

Actions #12

Updated by Katharina Strasser about 2 years ago

This seams to be still an issue with 11.5.15

Actions #13

Updated by Oliver Hader about 2 years ago

  • Related to Bug #97606: Autocreated redirects ignore PageTypeSuffix (e.g. ".html") added
Actions #14

Updated by Oliver Hader about 2 years ago

  • Sprint Focus set to On Location Sprint
Actions #15

Updated by Oliver Hader about 2 years ago

  • Related to deleted (Bug #97606: Autocreated redirects ignore PageTypeSuffix (e.g. ".html"))
Actions #16

Updated by Oliver Hader about 2 years ago

  • Is duplicate of Bug #97606: Autocreated redirects ignore PageTypeSuffix (e.g. ".html") added
Actions #17

Updated by Oliver Hader about 2 years ago

  • Status changed from New to Closed
Actions #18

Updated by Oliver Hader about 2 years ago

  • Related to deleted (Bug #93483: Redirects: .html page suffix not supported)
Actions #19

Updated by Oliver Hader about 2 years ago

  • Is duplicate of Bug #93483: Redirects: .html page suffix not supported added
Actions #20

Updated by Oliver Hader about 2 years ago

  • Status changed from Closed to Accepted
Actions #21

Updated by Oliver Hader about 2 years ago

  • Related to deleted (Bug #92101: Redirects: File Extension breaks redirect)
Actions #22

Updated by Oliver Hader about 2 years ago

  • Has duplicate Bug #92101: Redirects: File Extension breaks redirect added
Actions #23

Updated by Oliver Hader about 2 years ago

  • Assignee set to Oliver Hader
Actions #24

Updated by Oliver Hader about 2 years ago

  • Assignee changed from Oliver Hader to Stefan Bürk
Actions #25

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

Actions #26

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:

https://example.com/products

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.

Actions #27

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

Actions #28

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

Actions #29

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

Actions #30

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

Actions #31

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

Actions #32

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

Actions #33

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

Actions #34

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

Actions #35

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

Actions #36

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

Actions #37

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

Actions #38

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

Actions #39

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

Actions #40

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

Actions #41

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

Actions #42

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

Actions #43

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

Actions #44

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

Actions #45

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

Actions #46

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

Actions #47

Updated by Stefan Bürk almost 2 years ago

  • Related to Feature #99746: Introduce event to manage auto redirect create sources added
Actions #48

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

Actions #49

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

Actions #50

Updated by Gerrit Code Review over 1 year 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

Actions #51

Updated by Gerrit Code Review over 1 year 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

Actions #52

Updated by Gerrit Code Review over 1 year 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

Actions #53

Updated by Gerrit Code Review over 1 year 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

Actions #54

Updated by Gerrit Code Review over 1 year 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

Actions #55

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

Actions #56

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

Actions #57

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

Actions #58

Updated by Stefan Bürk over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #59

Updated by Benni Mack 4 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF