Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mklooss/781f70a025cce24eee6845ee115ddace to your computer and use it in GitHub Desktop.
Save mklooss/781f70a025cce24eee6845ee115ddace to your computer and use it in GitHub Desktop.
Create Magento2 CMS Page URLs if Missing, idk why, but we missed some
INSERT INTO url_rewrite
SELECT
NULL AS url_rewrite_id,
'cms-page' AS entity_type,
cp.page_id AS entity_id,
cp.identifier AS request_path,
CONCAT('cms/page/view/page_id/', cp.page_id) AS target_path,
0 AS redirect_type,
1 AS store_id,
NULL as description,
1 AS is_autogenerated,
NULL as metadata
FROM cms_page AS cp
WHERE
cp.is_active = 1 AND cp.identifier != 'no-route' AND cp.identifier != 'home'
ON DUPLICATE KEY UPDATE metadata = NULL;
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment