Question

I tried to 301 redirect contact form page URL to custom cms page URL with Magento 2's rewrites, but it does not seem to redirect the URL for some reason.

Is there some special trick to be done with contact form redirection?

Was it helpful?

Solution

Create a custom url rewrite in your admin.

Target path: custom-cms-url (without any slahes /)

Request path: contact

Make sure you have a cron job setup for reindexing and that the url rewrite was made for the correct store view.

OTHER TIPS

You can use.htacess write following code

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]

or you can do with admin panel also

1st -> go to admin -> marketing -> seo&search -> urlrewrite change url according to your requirements

I would suggest overwriting contact form. To do that create a contact_index_index.xml file in Your_Theme_Folder > Magento_Contact > layout

You can here add CMS block for example.

You can also overwrite template by creating a form.phtml file in Your_Theme_Folder > Magento_Contact > templates to edit the default form template.

With those two methods, you can fully overwrite the default contact page.

If you really want to use a CMS Page I think the best way is to disable contact us feature in Configuration > Contacts > Contacts us and disable contact us. Then create your CMS Page with the default contact url.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top