I have created a custom module in Magento 2.1.3 and its layout file is located in


but the system loads the layout from


instead of my custom layout file.

How can I override this vendor layout file with my custom layout file?

My customer_account_create.xml file is

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="customer_form_register">
            <argument name="template" xsi:type="string">RP_Testmodule::form/register.phtml</argument>

but the module does not take this layout.

I have created the resister.phtml and it is located in


My register.phtml file is


My module.xml file is


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <module name="RP_Testmodule" setup_version="1.0.0">
            <module name="Magento_Customer" />

My di.xml file is


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"


My registration.php file is




These commands are executed successfully

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy

php bin/magento cache:clean

php bin/magento cache:flush

But all after that, still it's not working.

Thanks in advance


Try this:

    <referenceBlock name="customer_form_register">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">RP_Testmodule::form/register.phtml</argument>

This is working for me.

|improve this answer|||||
  • Negative, still it's not working. – Kunal Ray Jun 6 '18 at 8:08
  • have you flushed cache after update it? – kunj Jun 6 '18 at 8:13
  • Flush, clean, di:compile all tried – Kunal Ray Jun 6 '18 at 9:26
  • Is there another modules who overriding same file? – kunj Jun 6 '18 at 9:29
  • No, it's a fresh Magento setup – Kunal Ray Jun 6 '18 at 9:31

Change to your template with:

<referenceBlock name="customer_form_register" template="Vendor_Modulename::filename.phtml"/>
|improve this answer|||||
  • It's also not working. – Kunal Ray Jun 6 '18 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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