简体   繁体   English

Wordpress联系表(未找到404)

[英]Wordpress contact form (404 not found)

I created a template on wordpress and I made a html form. 我在wordpress上创建了一个模板,然后我制作了一个html表单。 It works well in html, but doesn't work when used on wordpress. 它在html中运行良好,但在wordpress上使用时不起作用。 It seems that it doesn't find my contact-send.php page and it displays 404 Error page. 它似乎找不到我的contact-send.php页面,它显示404错误页面。

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 code error once it doesn't find contact-send.php. 我只是没有,因为我认为一旦它找不到contact-send.php就不是代码错误。

Best regards. 最好的祝福。

Use an absolute URL for the target of your form instead of just action="contact-send.php" . 使用表单目标的绝对URL而不仅仅是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 . 但是,除非您对联系表单有特别不寻常的要求,否则使用联系表格7等许多流行的联系表单插件之一可能会有更好的结果。

Using a well-maintained plugin ensures stability, and more importantly, security. 使用维护良好的插件可确保稳定性,更重要的是确保安全性。 Don't reinvent the wheel if you don't have to. 如果你不需要,不要重新发明轮子。

Your problem can be caused due to 3 reasons. 您的问题可能是由于3个原因造成的。

  1. Giving wrong path in action tag. 在行动标签中给出错误的路径。 Using <?php echo get_template_directory_uri(); ?>/contact-send.php 使用<?php echo get_template_directory_uri(); ?>/contact-send.php <?php echo get_template_directory_uri(); ?>/contact-send.php will solve this problem. <?php echo get_template_directory_uri(); ?>/contact-send.php将解决这个问题。
  2. Missing contact-send.php page in the themes folder. 缺少themes文件夹中的contact-send.php页面。 This problem can be solve by adding the page to the themes folder. 将该页面添加到themes文件夹可以解决此问题。
  3. Improper .htaccess file. 不正确的.htaccess文件。 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. 这可以通过从Dashboard > Permalinks重新创建.htaccess文件的代码并将其粘贴到WordPress根目录中的.htaccess文件中来解决。

I am giving the explanation in the assumption that your template file is directly in the themes folder. 我假设你的模板文件直接在themes文件夹中给出了解释。

Add <?php echo get_template_directory_uri(); ?>/contact-send.php 添加<?php echo get_template_directory_uri(); ?>/contact-send.php <?php echo get_template_directory_uri(); ?>/contact-send.php . <?php echo get_template_directory_uri(); ?>/contact-send.php When you write contact-send.php only then it don't find your file which is in your theme. 当你编写contact-send.php时,它找不到你主题中的文件。 So use this <?php echo get_template_directory_uri(); ?>/contact-send.php 所以使用这个<?php echo get_template_directory_uri(); ?>/contact-send.php <?php echo get_template_directory_uri(); ?>/contact-send.php in form action. 表单操作中的<?php echo get_template_directory_uri(); ?>/contact-send.php This change may be helpful. 这种变化可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM