[Solved] — Incorrect Redirect on Comment Submission
Edit: Thanks to WordPress Answers user peteroak the problem with the comments is now fixed.
Turns out that I’d accidentally got an extra redirect statement in the .htaccess file for the blog that required the comment submission to come from this site’s url to prevent some automatically submitted spam. Unfortunately, it had been added to this site but included our development site’s url. Which means it would never allow any comments to reach WordPress.
Lesson: Also check the .htaccess file.
Normal service is resumed.
You may have noticed if you’ve tried to submit a comment to this site recently that it hasn’t worked since I moved servers. I was feeling quite smug at the complete lack of spam submissions and assuming that bad_behaviour was killing everything before it got to WordPress but eventually, a complete lack of any comments for weeks got my attention.
Clearly the problem exists on my end: instead of submitting the comment, the comment script is redirecting the visitor back to their own ip address. Where no web server exists. And the request times out.
However, I’ve drawn a complete blank about how that is happening,
-
I’ve reinstalled WP from the dashboard and checked all the plugins are up-to-date
-
I’ve checked that my working test site shares the same code as the public site
-
I’ve tried deactivating all the plugins and reverted to the twenty-eleven theme
-
I’ve tested comment submission from more than one IP address and computer
-
My traffic logs for this vhost show incoming comment requests (from me and others) but no comments are visible in the WP dashboard
all without affection the faulty comment submission.
Does anyone know what is causing WordPress to redirect the form submission back to the browser’s ip address?
Obviously, commenting on this post is probably a waste of time (though you’re welcome to try) so If you can help, please email me at contact@def-proc.co.uk
Here’s what does happen on my development site when a comment is successfully submitted — hosted on the same server and on the served to the same IP address as the live site and running the same WordPress version and plugins:
Request URL:http://**(development)**.def-proc.co.uk/blog/wp-comments-post.php
Request Method:POST
Status Code:302 Moved Temporarily
Form Data
author:My Name
email:email@my.mail.box
url:**(empty)**
comment:Comment contents.
akismet_comment_nonce:**(akismet nonce)**
submit:Post Comment
comment_post_ID:90
comment_post_ID:90
comment_parent:0
bb2_screener_:**(bb2 nonce)** **(my ip address)**
Response Headers
Cache-Control:no-cache, must-revalidate, max-age=0
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:20
Content-Type:text/html
Date:Wed, 01 Aug 2012 17:24:10 GMT
Expires:Wed, 11 Jan 1984 05:00:00 GMT
Keep-Alive:timeout=15, max=100
Last-Modified:Wed, 01 Aug 2012 17:24:10 GMT
Location:http://**(development)**.def-proc.co.uk/blog/2010/**(test post)**/comment-page-1/#comment-120
Pragma:no-cache
Server:Apache
Set-Cookie:comment_author_**(wp nonce)**=My+Name; expires=Sun, 14-Jul-2013 22:44:10 GMT; path=/blog/, comment_author_email_**(wp nonce)**=contact%40def-proc.co.uk; expires=Sun, 14-Jul-2013 22:44:10 GMT; path=/blog/, comment_author_url_**(wp nonce)**=deleted; expires=Tue, 02-Aug-2011 17:24:09 GMT; path=/blog/
Vary:Accept-Encoding
But instead, on the live site, this happens:
Request URL:http://www.deferredprocrastination.co.uk/blog/wp-comments-post.php
Request Method:POST
Status Code:302 Found
Response Headers
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:243
Content-Type:text/html; charset=iso-8859-1
Date:Wed, 01 Aug 2012 17:34:41 GMT
Keep-Alive:timeout=15, max=100
Location:http://**(my ip address)**/
Server:Apache
Vary:Accept-Encoding
Edit: Comments are now working again.
Patrick Fenner wrote, “And we're starting to get some spam comments comming through, so someone else has found that it's working too!”