diff --git a/composer.json b/composer.json index f191d85..ed4a351 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "type": "kirby-plugin", "description": "Setup performant HTTP Status Code Redirects from within the Kirby Panel", "homepage": "https://github.com/bnomei/kirby3-redirects", - "version": "1.11.0", + "version": "1.12.0", "license": "MIT", "authors": [ { diff --git a/index.php b/index.php index 1687880..0f27587 100644 --- a/index.php +++ b/index.php @@ -17,12 +17,14 @@ 'plugin-redirects3xx' => __DIR__ . '/blueprints/sections/redirects3xx.yml', ], 'hooks' => [ - 'route:before' => function () { - $isPanel = str_contains(kirby()->request()->url()->toString(), kirby()->urls()->panel()); - $isApi = str_contains(kirby()->request()->url()->toString(), kirby()->urls()->api()); - $isMedia = str_contains(kirby()->request()->url()->toString(), kirby()->urls()->media()); - if (!$isPanel && !$isApi && !$isMedia) { - \Bnomei\Redirects::singleton()->redirect(); + 'page.render:before' => function (string $contentType, array $data, Kirby\Cms\Page $page) { + if ($page->isErrorPage()) { + $isPanel = str_contains(kirby()->request()->url()->toString(), kirby()->urls()->panel()); + $isApi = str_contains(kirby()->request()->url()->toString(), kirby()->urls()->api()); + $isMedia = str_contains(kirby()->request()->url()->toString(), kirby()->urls()->media()); + if (!$isPanel && !$isApi && !$isMedia) { + \Bnomei\Redirects::singleton()->redirect(); + } } }, 'page.update:after' => function (Kirby\Cms\Page $newPage, Kirby\Cms\Page $oldPage) { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 3cac240..3e7d980 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,8 +1,8 @@ array( 'name' => 'bnomei/kirby3-redirects', - 'pretty_version' => '1.11.0', - 'version' => '1.11.0.0', + 'pretty_version' => '1.12.0', + 'version' => '1.12.0.0', 'reference' => NULL, 'type' => 'kirby-plugin', 'install_path' => __DIR__ . '/../../', @@ -11,8 +11,8 @@ ), 'versions' => array( 'bnomei/kirby3-redirects' => array( - 'pretty_version' => '1.11.0', - 'version' => '1.11.0.0', + 'pretty_version' => '1.12.0', + 'version' => '1.12.0.0', 'reference' => NULL, 'type' => 'kirby-plugin', 'install_path' => __DIR__ . '/../../',