I have added a Contact form in a CMS Contact page.

  • added Layout Update XML section
  • added vendor/magento/module-contact/views/frontend/templates/contact.phtml
  • vendor/magento/module-contact/controller/index/post.php commented the default redirect at line number 90 & added : $this->_redirect('my_cms_contact.html');

Although on Success captcha, form is submitted and flash message seen on same cms page. However, when wrong captcha is submitted it redirects to /Contact/index/index

How to redirect to my_cms_contact.html & show flash message, when wrong captcha is entered.

1 Answer 1


The captcha check for the contact us page is in this file - vendor\magento\module-captcha\Observer\CheckContactUsFormObserver.php

Also, you are making the changes directly in the core files which is not a recommended method. It would be better if you override it as it would be easier while performing the Magento version upgrade process.

Thank you.

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.