Skip to content

Magento 2 blocks not showing up on homepage after cloning to localhost

I have copied my Magento 2 website from production to a:

Local Environment:

  • Ubuntu 20.04.4 LTS
  • Apache 2.4.41
  • MySQL Version 15.1 Distrib 10.5.16-MariaDB
  • PHP 7.4.30

in the normal way:

  • Copied all Magento files to my new webroot
  • Created a new database and copied the production database to it
  • Adjusted app/etc/env.php and core_config_data accordingly
  • Ran the necessary Magento commands

I have a working website, except for one thing: the homepage blocks are not displaying. Header and footer are there but not the custom blocks which should be loaded as they are on the production site.

the cms_index_index.phtml code is good:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
    <!-- <meta name="google-site-verification" content="" /> -->
    <meta name="google-site-verification" content="" />
    </head>
    <body>
        <referenceContainer name="main" htmlTag="div" htmlClass="column main" />
        <referenceContainer name="content">
                        <block class="MagentoFrameworkViewElementTemplate" name="test" template="Magento_Cms::homepage.phtml"></block>
                </referenceContainer>
    </body>
</page>

But the 6 blocks created in the Magento admin and enhanced by the homepage.phtml in the templates directory do not display.

I tested an intentional error in cms_index_index.xml, flushed, re-compiled, no errors logged. I tried switching themes, saved, and back again. There are no JavaScript errors in the console other than a font not being found and there’s nothing relevant in system.log, exception.log or apache2.log.