-->

Contact Form 7 cause HTTP 500 error

2020-07-11 07:17发布

问题:

No one is able to submit forms, I took a look at it and I’m getting a POST 500 Internal Server Error.

POST http://carlsbad4rent.com/wp-json/contact-form-7/v1/contact-forms/321/feedback 500 (Internal Server Error)

Note: The same code is working well in localhost[wamp]

回答1:

You need change in .htaccess file and in local setup folder name set as "wordpress" but in live site we have to change this name.

Before

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /agilitycards/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /agilitycards/index.php [L]
</IfModule>

# END WordPress

You need to replace with below code in .htaccess file.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


回答2:

I had this same problem - turned out it was related to the Polylang plugin I was using, in particular how I was registering strings to be translated.

A quick way to test is to disable your theme / enable the default theme and if Contact Form works, it's most likely to be a problem in the theme Functions file.

For me, the fix was setting the Polylang translations in functions.php like so:

if (function_exists("pll_register_string")) {
    pll_register_string( 'name', 'Translated string' );
}


回答3:

Had a 500 Status Code as well when submitting my Contact Form 7. Somehow the file "class-phpmailer.php" in "wp-includes" had a filepermission of "0". I have no idea why. But i fixed this issue by changing the files permission to 0644 and now my Contact Form 7 works well, again.



回答4:

I had a similar problem, it turned out that the error was being caused by ModSecurity installed on the cpanel. Disabling ModSecurity did the trick for me. In my research, I came across similar problems that were caused by security modules on their servers like this case that was caused by All in One Security and Firewall.