QUALITY PATCH

ACSD-57045: URL rewrites cause infinite page looping after Website Root is deselected from Hierarchy

URL rewrites cause infinite page looping after Website Root is deselected from Hierarchy. Quality patch ACSD-57045 for magento/module-versions-cms applies to Magento Open Source and Adobe Commerce 2.4.5 to 2.4.6-p15.

Categories
Content
Components
magento/module-versions-cms, magento/module-versions-cms-url-rewrite
Origin
adobe-commerce-support
Since QPT
1.1.49

Issue

URL rewrites cause infinite page looping after Website Root is deselected from Hierarchy.

Steps to reproduce

1. Create a CMS page named Test-Parent. 1. Create a page named Test-Child, and in the Hierarchy section, select Website Root > Parent and save. 1. Go to Marketing > URL Rewrites. 1. Notice that there are two new rewrites: * Request path to Test-Parent that points to cms/page/view/page_id/ID_NUMBER_FOR_PAGE * Request path to Test-Child that points to cms/page/view/page_id/ID_NUMBER_FOR_PAGE 1. Visit the storefront and add test-child to the URL. You should see the child page. 1. Do the same thing, but add test-parent/test-child/ to the URL and see the same page. 1. Go to Marketing > URL Rewrites and select Add URL Rewrite. Choose the following settings: * Type: Custom * Request path: test-parent/test-child * Target path: test-child * Redirect Type: Permanent (301) 1. Visit the test-parent/test-child path and you should be redirected to test-child. 1. Edit the Child page (Content > Elements > Pages > Pick Child and select Edit). 1. Under the Hierarchy section, keep Test-Parent selected but unselect Website Root and save. 1. Go to Marketing > URL Rewrites and notice that the original test-child to cms/page/view/page_id redirect is missing, and at that point it is substituted by a path that points the test-child to test-parent/test-child. 1. Visit the storefront and try to visit the Test-Child page.

Adobe's page lists 2.4.5 - 2.4.6-p7 as compatible; the versions below are resolved from the current QPT constraints and are the ones the tool will offer.

Adobe scheduled the permanent fix for 2.5.0.

Install

Install the Quality Patches Tool with composer require magento/quality-patches, apply the prerequisites listed for all files applicable to your distribution and version first, then run vendor/bin/magento-patches apply ACSD-57045. On Cloud, add ACSD-57045 under stage.build.QUALITY_PATCHES in .magento.env.yaml.

For cweagans/composer-patches, choose a compatible version below and download the bundle. Copy its ACSD-57045/ folder into patches/composer/, merge composer.patches.json into composer.json, then run composer install. Bundle prerequisites the same way and list them first. Paths are relative to each package root, using the default -p1 level. Prefer local files when configuring composer-patches; a remote URL can change.

Patch files and compatible versions

Packages across compatible versions (2): magento/module-versions-cms, magento/module-versions-cms-url-rewrite

magento/magento2-ee-base >=2.4.5 <2.4.7

Magento Open Source
—
Adobe Commerce
2.4.6-p15, 2.4.6-p14, 2.4.6-p13, 2.4.6-p12, 2.4.6-p11, 2.4.6-p10, 2.4.6-p9, 2.4.6-p8, 2.4.6-p7, 2.4.6-p6, 2.4.6-p5, 2.4.6-p4, 2.4.6-p3, 2.4.6-p2, 2.4.6-p1, 2.4.6, 2.4.5-p17, 2.4.5-p16, 2.4.5-p15, 2.4.5-p14, 2.4.5-p13, 2.4.5-p12, 2.4.5-p11, 2.4.5-p10, 2.4.5-p9, 2.4.5-p8, 2.4.5-p7, 2.4.5-p6, 2.4.5-p5, 2.4.5-p4, 2.4.5-p3, 2.4.5-p2, 2.4.5-p1, 2.4.5
Patch file
patches/commerce/ACSD-57045_2.4.6-p2.patch
  • vendor/magento/module-versions-cms/Observer/Backend/CmsPageSaveAfterObserver.php
  • vendor/magento/module-versions-cms/Observer/Backend/CmsPageSaveBeforeObserver.php
  • vendor/magento/module-versions-cms/Plugin/Cms/Model/PageRepositoryPlugin.php (added)
  • vendor/magento/module-versions-cms/etc/di.xml
  • vendor/magento/module-versions-cms-url-rewrite/Plugin/Cms/Model/PageRepositoryPlugin.php

Sources

Łukasz Bajsarowicz
Built by

Łukasz Bajsarowicz, e-commerce architect

Magento and Adobe Commerce architecture, upgrades, performance and audits for merchants and agencies since 2015; magento.watch is the tooling I use on those projects.

Open source, maintained on weekends.