Community & Support

"Page not found" message when adding a new comment

I have created a forum but have discovered the following problem:

If I select the option to add a new comment to an existing post and click Post comment, the message "Page not found" is displayed, but the comment is correctly posted.

The url of the page for which the "page not found" message is displayed is the correct URL for the post. For example:

http://example.com/test/index.php?q=node/7#comment-38
(If I refresh the page, it displays correctly)

I checked the logs in Drupal and found the following 2 entries (in descending chronological order):

Type page not found
Date Friday, October 19, 2007 - 11:58
User testuser01
Location http://example.com/test/index.php?q=node/7#comment-38
Referrer http://example.com/test/index.php?q=comment/reply/7
Message node/7#comment-38
Severity warning

Type content
Date Friday, October 19, 2007 - 11:58
User testuser01
Location http://example.com/test/index.php?q=comment/reply/7
Referrer http://example.com/test/index.php?=comment/reply/7
Message Comment: added Test comment.
Severity notice

I have a similar problem when I reply to a post.

I can post new topics without any problem.

I am using Drupal 5.2 on IIS 6.

Has anybody encountered similar problems?

Comments

Have you made any progress

Have you made any progress with this?

I am getting exactly the same behaviour.

I'm on Drupal 5.2 hosted on IIS.

As far as I can tell it only happens when using IE to post replies.

As with you I get a page not found as soon as I post the reply but if I then refresh the page displays correctly.

Andy

No progress with this

The only progress I've made is that I've discovered that the problem does not occur with the latest version of Firefox or Internet Explorer 7 (I am using Internet Explorer 6).

I've tried upgrading to Drupal 5.3 but still have the same problem.

I've only been using Drupal

I've only been using Drupal for about 2 weeks so pretty new to all this. Can any one give me/us any techniques, procedures that might let us progress this. Anyway of monitoring whats going on, capturing some info that might give someone a clue?

Thanks

Andy

Ok. Not sure if this has

Ok. Not sure if this has cured the problem but for now its gone away from my installation.

I have done the following...

Turned on ISAPA rewrites using ISAPI_Rewrite 3 Lite from Helicon. Followed instruction from http://drupal.org/node/46429
Turned on Clean URL's
Enabled the unicode library mbstring in settings

Not sure which made the difference (doubt the last one) but its gone for now.

Andy

Till a fix is released...

I had this same issue, and it was causing much problems for my intranet website at work. Everyone here uses IE6 because they use proprietary software that is dependent on it. There is no possibility for upgrade. Though I use firefox, that isn't possible for all users because of that software and because Active Directory can't force a homepage in firefox effectively. Anyway, I am in need of a fix... but till then, this fixed it for me.

This will redirect a user after posting a comment to just the node/$nid instead of node/$nid#comment-$cid, which can't be found for some reason upon redirect in IE6.

change:

<?php
function comment_form_submit($form_id, $form_values) {
 
$form_values = _comment_form_submit($form_values);
  if (
$cid = comment_save($form_values)) {
    return array(
'node/'. $form_values['nid'], NULL, "comment-$cid");  //THIS LINE
 
}
}
?>

to:

<?php
function comment_form_submit($form_id, $form_values) {
 
$form_values = _comment_form_submit($form_values);
  if (
$cid = comment_save($form_values)) {
    return array(
'node/'. $form_values['nid'], NULL, NULL);
  }
}
?>

How do you post new comment?

If you are replying to a post, insert the cid of that post to new post. This might solve your problem. One more thing, Can you explain how do you able to post new comments?

Thank you.
Beautiful mind
Know more

i got same problem

exactly same problem.

the system i am using is Drupal 5.7

server is IIS6,

And this "page not found" only appears on IE, no problem with firefox and opera

and it seems only got problem for IIS,

i moved the whole site to another two linux / apache servers, one with url rewrite and one without,

tried with IE again, bot have no problem at all.

so it seems comments crashed when you use both IE and IIS.....

Same issue using IE6, Drupal 6.8 and IIS6

After comment is posted, Page Not Found shows.
The address bar also shows something like:

http://localhost/drupal/index.php?q=node/9#comment-23

However when you read the properties of the displayed page (rightclick -> properties), the page URL is actually:

http://localhost/drupal/index.php?q=node/9#comment-23comment-23

Which explains why it shows "Page not found" and why upon refresh it shows OK.
But how to fix?

I'm having exactly the same

I'm having exactly the same problem, down to the bad url.

I've been having my users press F5 for now, this takes them back to the thread. But it's definitely an annoying issue.

Server: Windows 2003, IIS 6, Drupal 6.10
Client machines: Windows XP Pro, IE 6

Tested with IE7 and Firefox, it works perfectly. With IE6, we get the "Page not found" with the bad url in the properties as described by fin_777

Set up a sandbox environment, running IIS 5.1 on Win XP, with a duplicate of my site. Problem exists there too.

The issue does NOT occur when

The issue does NOT occur when devel module's "Display redirection page" is enabled.

The issue does NOT occur when there are multiple pages of comments.

I've traced everything as well as I can, and from what I can see, the Drupal system is sending a perfectly valid redirect URL.

Something in the workings between IE 6 and IIS is adding a second copy of the 'fragment' portion of the URL to the end of the URL. It seems that if the $page variable inside comment_form_submit() is blank or NULL, the URL gets messed up for IE6. I can put an arbitrary string in there, and everything works just fine.

I just tested by changing the $form_state['redirect'] to:
$form_state['redirect'] = array('node/'. $node->nid, "z", "comment-$cid");
from:
$form_state['redirect'] = array('node/'. $node->nid, $page, "comment-$cid");

and IE 6 was redirected to this URL:
http:// localhost/drupal/index.php?q=node/188&z#comment-79

It pulled up the thread just fine.

Packet capture results

I did a packet capture running the same Drupal on IIS and Apache, adding a comment with Firefox 3.0.7 and IE6. Some interesting results were revealed. Raw packet captures are below.

Both IIS and Apache return IE6 to the url http://localhost/training/?q=node/188#comment-82comment-82 but when the page is served from IIS, it results in a "Page not found" error.
Going to a valid url with an invalid anchor does not normally result in "Page not found", it just puts the browser view at the top of the page.

The packets sent from Apache and IIS to IE6 are both apparently identical (or as identical as they can be, at least), I'm seeing no significant differences.

The one difference I do see is that the GET request for IE6 on both webservers is GET /training/index.php?q=node/188#comment-62 HTTP/1.1 whereas for Fx, it's GET /training/index.php?q=node/188 HTTP/1.1

Note the missing anchor name on the Fx request (or the addition of the anchor name on the IE6 request, depending on how you look at it.)

The $form_state['redirect'] statement in the comment.module appends the fragment name onto the GET url, which results in IE being directed to node/188#comment-62comment-62 but I don't think this is the source of the problem.

At this point, I am completely unsure of where to go with this, and I think I'll just add a conditional statement in the comment.module to add a useless URL variable that Drupal will ignore when the $page variable is empty. I've tried this solution and it works fine.

Raw packet captures:

IIS IE6
682 19.615168 127.0.0.1 127.0.0.1 HTTP GET /training/index.php?q=node/188#comment-62 HTTP/1.1
E7@yPP@GET /training/index.php?q=node/188#comment-62 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/msword, */*
Referer: http://localhost/training/index.php?q=comment/reply/188
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Host: localhost
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: icid=0; idsc=0; ih1=266; ih2=133; iw1=133; iw2=372; has_js=1; SESS4253c31b1871fdc68c109cd700f008e6=1a770pc42g47rceft6sir7hlf3

IIS Fx
721 15.834010 127.0.0.1 127.0.0.1 HTTP GET /training/index.php?q=node/188 HTTP/1.1
Es@yPP@GET /training/index.php?q=node/188 HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/training/index.php?q=comment/reply/188
Cookie: icid=0; idsc=0; ih1=264; ih2=132; iw1=132; iw2=372; SESScfc90a62c81b7bfc6f292320b1d0b8ca=k6c59i54g1eqvp1j6i3oiabet5; SESS6fc27fe2deeac22f387f0ea042fd3e68=6sbehq4ja8tj1rbpk9p9dqfmg3; has_js=1; ASPSESSIONIDSABDRQCB=MPIFPPMBJDJPFKDINHBDJPMD; SESS4253c31b1871fdc68c109cd700f008e6=05p7jrorg3hmsntoefajmr90p5
If-Modified-Since: Thu, 26 Mar 2009 16:54:19 GMT

Apache IE6
683 16.294880 127.0.0.1 127.0.0.1 HTTP GET /training/?q=node/188#comment-82 HTTP/1.1
E%@yPP@GET /training/?q=node/188#comment-82 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/msword, */*
Referer: http://localhost/training/?q=comment/reply/188
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Host: localhost
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: icid=0; idsc=0; ih1=266; ih2=133; iw1=133; iw2=372; has_js=1; SESS4253c31b1871fdc68c109cd700f008e6=6q479up1h2ovgq92k6hvveskm4

Apache Fx
675 16.243990 127.0.0.1 127.0.0.1 HTTP GET /training/?q=node/188 HTTP/1.1
Ea@yP3P@GET /training/?q=node/188 HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/training/?q=comment/reply/188
Cookie: icid=0; idsc=0; ih1=264; ih2=132; iw1=132; iw2=372; SESScfc90a62c81b7bfc6f292320b1d0b8ca=k6c59i54g1eqvp1j6i3oiabet5; SESS6fc27fe2deeac22f387f0ea042fd3e68=6sbehq4ja8tj1rbpk9p9dqfmg3; has_js=1; ASPSESSIONIDSABDRQCB=MPIFPPMBJDJPFKDINHBDJPMD; SESS4253c31b1871fdc68c109cd700f008e6=9332nvm0kbh99jb2q8ubcqa2b5
If-Modified-Since: Thu, 26 Mar 2009 16:58:56 GMT

Patch

Here's a patch that fixed the issue on my setup.

--- comment.module 2009-03-26 11:39:17.421875000 -0600
+++ comment.module.new 2009-03-26 11:39:28.796875000 -0600
@@ -1540,7 +1540,11 @@ function comment_form_submit($form, &$fo
   if ($cid = comment_save($form_state['values'])) {
     $node = node_load($form_state['values']['nid']);
     $page = comment_new_page_count($node->comment_count, 1, $node);
-    $form_state['redirect'] = array('node/'. $node->nid, $page, "comment-$cid");
+    if ($page) {
+      $form_state['redirect'] = array('node/'. $node->nid, $page, "comment-$cid");
+    } else {
+      $form_state['redirect'] = array('node/'. $node->nid, "iisfix", "comment-$cid");
+    }
     return;
   }
}

Perfect

Thanks for the solution.

How to apply patch?

I'm pretty ignorant when it comes to PHP. The patch from Ogredude is apparently a change to comment.module, but I'm not sure where it goes. Is it replacing some of the existing code or is it added somewhere without replacing anything? (And if the latter, where to add it?)

Thanks in advance for any help!

-Chris

Seems to be an IIS / IE bug and not a Drupal bug

This ASP example describes the same issue:
http://www.bigresource.com/Tracker/Track-asp-W9Hf9ZxV/

I'll try Ogredude's workaround from http://drupal.org/node/184864#comment-1403472 and post the results here.

Works

I merged the patch into our Drupal Core. After some more test version 6.15.2 will be available for download here: http://drupal.cocomore.com/de/project/drupal

Released

Drupal 7 is moving along

Drupal 7 is moving along nicely, and is becoming increasingly stable.Journalists are expected to post news online immediately and to interact with the public, and they need to be able to do it without learning HTML or tools such as FTP. These requirements made Drupal a natural choice.
Führer Spielautomaten

http://www.ufficialesitohogan.com/

If you really want to hear about Hogan, the first thing you'll probably want to know is where Scarpe Hogan was born, and what my lousy Hogan Sito Ufficiale was like, and how my parents were occupied and all before they had Hogan Interactive, and all that David Copperfield kind of crap.

nobody click here