WordPress Comments Messed Up with Redirection … and the Hack

Read the comments 🙂

3 Comments

  1. I was told by two Pak Spectator readers (thanks guys) that the comments here are not working. My bad. I never checked them after setting up the domain redirection, so I spent an hour on the problem and found out (and fix(hack)ed the issue).
    For those of you that are interested or facing the same issues, it seems that the comment form (from comments.php in WordPress) sends a ‘POST’ request to wp-comments-post.php, which gets lost in redirection and mutates into a ‘GET’ request. The comments.php also uses the blog domain (www.reallyvirtual.com in this case), but since the redirection is posting on a subdomain (rv.cypherone.com), WordPress rejects it.
    The workaround: Edit your theme’s comments.php and hardcode the form ‘action’ domain to the ultimate destination domain, and then comment out the first block wp-comments-post.php so that WordPress bypasses the POST check. Finally, you may have to search replace all $_POST with $_GET.
    This leaves the door wide open for comment spammers, but at least the comments are working now, so I can put off a hosting move for another few weeks.

  2. UPDATE: after moving to linux hosting, I can finally restore the hack to its original code.

  3. Idetrorce says:

    very interesting, but I don’t agree with you
    Idetrorce