diff --git a/Classes/Service/NodeRedirectService.php b/Classes/Service/NodeRedirectService.php index 3ba223c..6fb16e6 100644 --- a/Classes/Service/NodeRedirectService.php +++ b/Classes/Service/NodeRedirectService.php @@ -85,6 +85,12 @@ class NodeRedirectService implements NodeRedirectServiceInterface */ protected $defaultStatusCode; + /** + * @Flow\InjectConfiguration(path="enableRemovedNodeRedirect", package="Neos.RedirectHandler.NeosAdapter") + * @var array + */ + protected $enableRemovedNodeRedirect; + /** * {@inheritdoc} */ @@ -133,9 +139,15 @@ protected function executeRedirectsForPublishedNode(NodeInterface $node, Workspa // The page has been removed if ($node->isRemoved()) { - $this->flushRoutingCacheForNode($targetNode); - $statusCode = (integer)$this->defaultStatusCode['gone']; - $this->redirectStorage->addRedirect($targetNodeUriPath, '', $statusCode, $hosts); + // By default the redirect handling for removed nodes is activated. + // If it is deactivated in your settings you will be able to handle the redirects on your own. + // For example redirect to dedicated landing pages for deleted campaign NodeTypes + if ($this->enableRemovedNodeRedirect) { + $this->flushRoutingCacheForNode($targetNode); + $statusCode = (integer)$this->defaultStatusCode['gone']; + $this->redirectStorage->addRedirect($targetNodeUriPath, '', $statusCode, $hosts); + } + return; } diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml new file mode 100755 index 0000000..caed407 --- /dev/null +++ b/Configuration/Settings.yaml @@ -0,0 +1,7 @@ +Neos: + RedirectHandler: + NeosAdapter: + # By default the redirect handling for removed nodes is activated. + # If it is deactivated in your settings you will be able to handle the redirects on your own. + # For example redirect to dedicated landing pages for deleted campaign NodeTypes + enableRemovedNodeRedirect: true