- Issue created by @joachim
redirect_path_alias_insert() takes care of deleting any redirects which have the same source as a path alias that is being created. This is to ensure that the path alias actually works.
However, redirect_path_alias_update() only does this if 'auto_redirect' is enabled in the settings:
function redirect_path_alias_update(PathAliasInterface $path_alias) {
$config = \Drupal::config('redirect.settings');
if (!$config->get('auto_redirect')) {
return;
}
/** @var \Drupal\path_alias\PathAliasInterface $original_path_alias */
$original_path_alias = $path_alias->original;
// Delete all redirects having the same source as this alias.
redirect_delete_by_path($path_alias->getAlias(), $path_alias->language()->getId(), FALSE);
Deletion of redirects with the same source should happen for updated path aliases regardless of the auto redirect setting.
Active
1.0
Code