In my WP site I’ve got a Contact page whose URL is mysite.com/contact/ and which contains a <form>
with an action attribute set to action=”/contact/”
Clicking on the submit button brings me to this : mysite.com/contact/
This is the exact URL of my contact page (which works very well if I use this URL). Yet, it gives a 404 after having arrived to that URL via the submit button !
This doesn’t make any sense to me, anybody can explain?
You’re probably using an input field that contains name=”name”. A lot of generic words are used by WordPress itself (incl. name, so a best practise is to always prefix_ your fields, like name=”prefix_name”.
To make the answer more complete, there is another case which will generate a 404 except using generic words in the name-attribute:
When you give the submit button a name attribute with ANY value, it will always redirect to a 404. So never use a name-attribute on input type=’submit’