#96651When pasting a page with redirects => error 'Attempt to insert record "sys_redirect…'
Description
Steps to reproduce:
- Create a new page, save
- Rename page, update slug => creates a redirect (check pid in table sys_redirect)
- Copy this page and paste into another page
- The following error message is thrown:
1: Attempt to insert record "sys_redirect:3" on a page (8) that can't store record type.
(the UID (8) is the one of the newly inserted page)
Reviews 1
Related issues 1
History 1217
-
Wolfgang Klinger changed description <span data-processor="relativetime" data-value="2022-01-26T10:37:25+00:00" > 01/26/22, 10:37 </span>
-
Stefan Bürk changed assigned to Stefan Bürk <span data-processor="relativetime" data-value="2022-02-23T21:42:39+00:00" > 02/23/22, 21:42 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 75020 status
NewUnder Review <span data-processor="relativetime" data-value="2022-07-02T14:31:14+00:00" > 07/02/22, 14:31 </span> -
Rozbeh Chiryai Sharahi commented <span data-processor="relativetime" data-value="2022-07-02T14:33:26+00:00" > 07/02/22, 14:33 </span>
-
Gerrit Code Review pushed patch set 2 for main to change 75020 <span data-processor="relativetime" data-value="2022-08-03T21:18:41+00:00" > 08/03/22, 21:18 </span>
-
Oliver Gassner changed Duplicated by #99697 <span data-processor="relativetime" data-value="2023-03-08T13:32:54+00:00" > 03/08/23, 13:32 </span>
-
Markus Klein commented <span data-processor="relativetime" data-value="2023-11-09T12:41:55+00:00" > 11/09/23, 12:41 </span>
I stipulate: redirects must never be copied.
-
Andy Meier commented <span data-processor="relativetime" data-value="2024-02-07T14:38:45+00:00" > 02/07/24, 14:38 </span>
@rozbehsharahi you patch set, applied separately by composer patches, resolves the problem in our 11.5.30 installation.
@stefan.buerk I hope, the fix will make it’s way to the main branch soon.
Thanks to all for your effort!
-
Rozbeh Chiryai Sharahi commented <span data-processor="relativetime" data-value="2024-02-23T11:18:58+00:00" > 02/23/24, 11:18 </span>
Andy Meier wrote in #note-8:
>rozbehsharahi you patch set, applied separately by composer patches, resolves the problem in our 11.5.30 installation.stefan.buerk I hope, the fix will make it’s way to the main branch soon.
>
>
>
> Thanks to all for your effort!Happy to hear that. If further support is needed, let me know.
-
Christian Ludwig commented <span data-processor="relativetime" data-value="2025-02-25T17:27:09+00:00" > 02/25/25, 17:27 </span>
A related issue exists in yoast_seo. See https://github.com/Yoast/Yoast-SEO-for-TYPO3/issues/602
So I think the idea of @Rozbeh Chiryai Sharahi`s patch would be helpful in that case as well.And related to this issue:
I see no sense in copying automatically generated redirects to new pages. The pages are new and have never been linked from somewhere else before. In addition when the source is copied unchanged, we’ll have multiple redirects with the same source uri what causes problems (where should we redirect to? To the new pasted page or to the old source page that was copied). -
Stefan Bürk commented <span data-processor="relativetime" data-value="2025-02-25T17:48:32+00:00" > 02/25/25, 17:48 </span>
Since TYPo3 v12 redirects are only on PID= 0 or site roots. They are not created on (standard) pages directly (expect site root pages)
-
Andreas Kießling changed Related to #104740 <span data-processor="relativetime" data-value="2025-03-11T15:25:00+00:00" > 03/11/25, 15:25 </span>
-
Andreas Kießling commented <span data-processor="relativetime" data-value="2025-03-11T15:27:12+00:00" > 03/11/25, 15:27 </span>
Would be great to have this in the core! I also have some log tables that store records on the page where the plugin is used —> no need to copy them when the page is duplicated.
-
Jo Hasenau commented and changed TYPO3 Version
1112 PHP Version7.48.3 <span data-processor="relativetime" data-value="2025-08-27T23:44:58+00:00" > 08/27/25, 23:44 </span>Stefan Bürk wrote in #note-11:
> Since TYPo3 v12 redirects are only on PID= 0 or site roots. They are not created on (standard) pages directly (except site root pages)That’s exactly the problem:
TCA says rootLine = -1 but misses ignorePageTypeRestrictions as described here: https://docs.typo3.org/m/typo3/reference-tca/12.4/en-us/Ctrl/#confval-ctrl-rootlevel
This leads to the weird situation, that you can not create a new redirects record on a (site root) page, that already contains a few hundred records of the same type, that is claimed to be not allowed there.
Checked the settings and the problem should apply to each TYPO3 version since the rootLine has been changed from 1 to -1 which is definitely correct.
-
Gerrit Code Review pushed patch set 3 for main to change 75020 <span data-processor="relativetime" data-value="2026-09-28T13:51:34+00:00" > 09/28/26, 13:51 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 75020 <span data-processor="relativetime" data-value="2026-09-29T11:15:15+00:00" > 09/29/26, 11:15 </span>
-
Gerrit Code Review pushed patch set 5 for main to change 75020 <span data-processor="relativetime" data-value="2026-09-29T12:38:32+00:00" > 09/29/26, 12:38 </span>
This happens also on version 12
—-
The reason for the error message
sys_redirect table is not allowed on standard pages
—-
How to proceed
I think this depends on the answer to the question: “Should redirects be allowed on standard pages?”.
—-
If yes
It might be simple: “[BUGFIX] Allow sys_redirect on standard pages”. (I could provide a patch, if needed)
—-
If no
In this case we assume that sys_redirect is not allowed on standard pages for good reasons. For example: Avoid spreading redirects in page-tree, …
The auto-redirects, however, get stored on standard-pages (the page which has a changed slug), which, on copy-pasting a page, leads to the attempt of data-handler to insert redirects on a target which is a standard-page. Summary: auto-redirects are created on standard-pages although not allowed by TCA.
Therefore, i see two more interesting possibilities to tackle this:
1) Change redirects extension to not create redirects on standard-pages (might be quite some work)
2) Introduce an option to exclude tables to be copied along with pages (would not directly address the issue and is rather a feature than a bugfix)
The reason I think 2) can be an option is that copying redirects along with pages could be wrong in many many cases. I’d think redirects belong to the copied pages most of the time … unless it’s a copied sys-folder, were the redirects are some kind of “pack-of-disabled-redirect-templates” or so. However in that case, it would still be possible to reactivate via TCA and allow sys-redirect entries on standard pages, on project level.
I provided a WIP patch for 2, in case it is considered a good solution.