Project

General

Profile

Actions

Bug #93964

closed

Edit page, modify page slug causes HTTP 404 on old page URL. TYPO3\CMS\Redirects\Service\SlugService::rebuildSlugsForSlugChange must force-rebuild redirects cache.

Added by Leonie Philine almost 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Start date:
2021-04-21
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

When editing a page and changing its slug, then saving the page record, then a new redirect is added by \TYPO3\CMS\Redirects\Service\SlugService::createRedirect.

However, the redirects cache is not cleared (\TYPO3\CMS\Redirects\Service\RedirectCacheService::rebuild is not invoked), and the page whose slug was changed (requested via its old URI) consistently throws a HTTP 404 Not Found instead of redirecting to its new URI.

Until:

  • Either the entire 'pages' cache is cleared, in which the redirects are serialized under the 'redirects' key;
  • Or until a sys_redirects record is modified and saved, which invokes \TYPO3\CMS\Redirects\Hooks\DataHandlerCacheFlushingHook::rebuildRedirectCacheIfNecessary.

Saving a page record with modified slug does not invoke \TYPO3\CMS\Redirects\Hooks\DataHandlerCacheFlushingHook::rebuildRedirectCacheIfNecessary, because \TYPO3\CMS\Redirects\Service\SlugService::createRedirect does not use the DataHandler to store the newly added sys_redirect record:
DataHandlerCacheFlushingHook only listens to DataHandler commands involving sys_redirect records being saved. This is not the case here.
Instead, \TYPO3\CMS\Redirects\Service\SlugService::createRedirect inserts the new record via the \TYPO3\CMS\Core\Database\ConnectionPool API.

Solution:

Call \TYPO3\CMS\Redirects\Service\RedirectCacheService::rebuild in \TYPO3\CMS\Redirects\Service\SlugService::rebuildSlugsForSlugChange just before $this->sendNotification();.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Feature #89115: Auto-create Redirects on Slug ChangesClosedFrank Nägler2019-09-09

Actions
Has duplicate TYPO3 Core - Bug #94808: Clear Cache when creating new redirect after slug change Closed2021-08-11

Actions
Actions #1

Updated by Felix Heller over 2 years ago

I can confirm that this problem still exists in TYPO3 11.5.0. If a redirect entry is added, edited or deleted in the backend module "Redirects", the redirect cache is cleared, but if a redirect is created because a page's slug was changed, then the redirect cache remains unchanged.

Actions #2

Updated by Felix Heller over 2 years ago

  • Related to Feature #89115: Auto-create Redirects on Slug Changes added
Actions #3

Updated by Helmut Hummel about 2 years ago

  • Has duplicate Bug #94808: Clear Cache when creating new redirect after slug change added
Actions #4

Updated by Helmut Hummel about 2 years ago

  • Status changed from New to Closed

Solved in the duplicate

Actions

Also available in: Atom PDF