0

I have tried to changed the default URL of contact page in magento2 to my custom URL but it is not working at all.

I have tried as follows:

Put the following code in my custom module.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Custom_Module" setup_version="1.0.0">
     <sequence>
        <module name="Magento_Contact"/>
    </sequence>
</module>

And then rewrite the route as follows in routes.xml file:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
   <router id="standard">
       <route id="contact" frontName="kontakt">
           <module name="Magento_Contact" />
       </route>
   </router>
</config>

Any Hint what is wrong going on here?

0

You can create url rewrite in Marketing > Url rewrites Click the Add URL rewrite button. Select the "Custom" URL rewrite type

Request Path kontact

Target Path contact/index/index

Redirect Type No

0

You can use alternative way, create CMS page from admin with name "kontakt" and add following form.phtml block in that CMS page, you will get what you want.

{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}

Please let me know if any issue.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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