Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress contact form (404 not found)

I created a template on WordPress and I made an html form. It works well in HTML but doesn't work when used on WordPress. It seems that it doesn't find my contact-send.php page and it displays a 404 Error page.

My permalinks were on default and it didn't work.

Does anyone know how to fix this?
If any of my code is needed, I'll post it. I just didn't because I think it's not a code error once it doesn't find contact-send.php.

like image 651
azhpo Avatar asked Oct 20 '22 00:10

azhpo


2 Answers

Use an absolute URL for the target of your form instead of just action="contact-send.php".

But unless you have particularly unusual requirements for your contact form, you will likely have better results using one of the many popular contact form plugins like Contact Form 7.

Using a well-maintained plugin ensures stability, and more importantly, security. Don't reinvent the wheel if you don't have to.

like image 200
Drew Hammond Avatar answered Oct 28 '22 22:10

Drew Hammond


Your problem can be caused due to 3 reasons.

  1. Giving wrong path in action tag. Using <?php echo get_template_directory_uri(); ?>/contact-send.php will solve this problem.
  2. Missing contact-send.php page in the themes folder. This problem can be solve by adding the page to the themes folder.
  3. Improper .htaccess file. This can be solved by recreating the code for your .htaccess file from Dashboard > Permalinks and paste it in the .htaccess file in the WordPress root directory.

I am giving the explanation in the assumption that your template file is directly in the themes folder.

like image 21
Anoop Asok Avatar answered Oct 28 '22 23:10

Anoop Asok