Wordpress Comments Messed Up with Redirection … and the Hack
Read the comments ![]()
Read the comments ![]()
ReallyVirtual posted this article under Wordpress comments php Programming webhost4life Wordpress on Sunday, July 15th, 2007 at 11:33 AM You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment or trackback from your own site. View Technorati Linkbacks.
Prev Article ← I Built the Empire State Building
Next Article → Moving hosting to Linux
Please subscribe to the RSS feed to stay up to date.
© Copyright 2008 ReallyVirtual - Sohaib Athar —
Subscribe to Articles (RSS)
or the Comments (RSS)
-
(On Jul 15th, 2007 at 11:34 AM)
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.
(On Jul 19th, 2007 at 1:05 PM)
UPDATE: after moving to linux hosting, I can finally restore the hack to its original code.
(On Dec 15th, 2007 at 10:17 AM)
very interesting, but I don’t agree with you
Idetrorce