I am creating a new custom theme for magento2.4.5. and to create a custom home page for base url (domain.com), I have done following:

In app/design/frontend/my-vendor/my-theme/Magento_Theme/layout/cms_index_index.xml (home.phtml contains the homepage html):

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        <referenceContainer name="cms_page" display="false"/>
        <referenceContainer name="content">
           <block class="Magento\Framework\View\Element\Template" 
                  name="homepage" template="Magento_Theme::html/home.phtml" before="-" />

This code only works for main/url "www.domain.com". But when I open "www.domain.com/home url", it still shows the magento2 default home page content instead of my custom home page content. I can not use admin panel because this config needs to be saved with my custom theme.

What is the difference between "cms_index_index" and "cms_home" and how to load custom homepage for "cms_home" handle (www.domain.com/hom) as well? Please help.

1 Answer 1


There is one configuration where you can select your default pages in magento.

Go to Admin -> Stores -> Configuration -> Geneal -> Web

Scroll down and you'll find Default Pages tab, and check if your default home page is selected

Hope this will work for you.

  • thanks. I need to save this config with custom theme. how to change default home page through xml config?
    – Varun
    Nov 6, 2023 at 22:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.