Oct 07, 2008, 02:26 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
Pages: 1 [2] 3   Go Down
  Print  
Author Topic: 200 error code being sent on 404 page instead of 404  (Read 11023 times)
0 Members and 1 Guest are viewing this topic.
chucky
Full Member
***
Posts: 147



WWW
« Reply #15 on: May 26, 2006, 01:22 PM »

it doesn't work ....
when i look at the response header of the page ( with the FF Web Dev Toolbar Extension ), there is a "404 OK", weird isn't it ? ( it seems the snippet couldn't "override" the header that was sent first )
thx

if you have any fix, please share Smiley
Logged

i'm not a native english speaker, sorry if there are any mistakes ! Smiley

Pikkitux.com Website about Ubuntu Linux, Website Creation, and many other how-tos, tips and tricks ... ( French Language, and of course Modx Powered ! )
Mark
Coding Team
*
Posts: 3,247


Ditto Developer


WWW
« Reply #16 on: May 26, 2006, 02:15 PM »

That won't work because headers need to be sent before page content. PHP may just be surpressing its errors...
Logged

PaulGregory
MODx's midnight runner
Moderator
*****
Posts: 1,095

MODx's midnight runner


WWW
« Reply #17 on: May 26, 2006, 07:57 PM »

There are of course a near-infinite number of 404 "pages", and this is potentially a major issue.

The problem was actually fixed, and then accidentaly unfixed in the process of putting out the security release recently. Look for an update very soon with a fix (again  Grin)

It's being worked on as quickly as possible. If it's that urgent, you're certainly welcome to grab the code and submit a patch if you can get to it faster than the coding team.

Some clue of how fast the coding team would otherwise get to it (and Victor, it's assigned to you) would be helpful in figuring out whether I can get to it faster!

This isn't as urgent as I first thought, as I've realised there's another solution to the Google issue (see below) - but still I expect fake 404 pages to pass a 404 code to the agent if not the server and would be happier if MODx did that.

If it's going to be more than a week or so, then I volunteer to pick up your previous fixed code and reapply it to 0.9.2.1. If you could just tell me where I can grab that fixed code from!

The bug report at http://modxcms.com/bugs/task/255?tasks=last mentions a fix at : http://modxcms.com/forums/index.php/topic,1052.0.html but I cannot access that forum page - if you could please PM me the code, it would make this do-able.

Alternatively, if you can't get the code to me, let me know and I'll investigate other avenues.

Fixing the Google issue
There are also 2 potential ways of solving the Google problem, by asking it not to index the fake 404 pages:
1) Custom robots.txt file with known (old) pages disallowed
2) Add
Code:
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
to a custom template for the 404 page. (I guess you only want NOINDEX there but I don't know if that would work so it's probably best to leave it as per the official example.)
For more on this angle, see http://www.google.com/support/webmasters/bin/answer.py?answer=35303

I'm going to put the meta tag in my 404 template, it seems the best way forward.
Logged

No, I don't know what OpenGeek's saying half the time either.
MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
Forum: Where to post threads about add-ons | Forum Rules
Like MODx? donate (and/or share your resources)
Like me? See my Amazon wishlist
MODx "Most Promising CMS" - so appropriate!
chucky
Full Member
***
Posts: 147



WWW
« Reply #18 on: May 27, 2006, 07:13 AM »

thx for the tip, i didn't think to the search engines tags !
Logged

i'm not a native english speaker, sorry if there are any mistakes ! Smiley

Pikkitux.com Website about Ubuntu Linux, Website Creation, and many other how-tos, tips and tricks ... ( French Language, and of course Modx Powered ! )
chucky
Full Member
***
Posts: 147



WWW
« Reply #19 on: Jun 04, 2006, 08:05 PM »

hi again  Wink
i added the robots meta tag in the 404 error page, i hope it will work ( google doesn't seem to crawl my site very often ... )
by the way, i am trying the etomite fix ( see the 1st post of this thread ), the solution is to modify the index.php file around line 700, but mine only have 100 ones  at most ...
Logged

i'm not a native english speaker, sorry if there are any mistakes ! Smiley

Pikkitux.com Website about Ubuntu Linux, Website Creation, and many other how-tos, tips and tricks ... ( French Language, and of course Modx Powered ! )
vbrilon
Coding Team
*
Posts: 256



« Reply #20 on: Jun 04, 2006, 08:09 PM »

hi again  Wink
i added the robots meta tag in the 404 error page, i hope it will work ( google doesn't seem to crawl my site very often ... )
by the way, i am trying the etomite fix ( see the 1st post of this thread ), the solution is to modify the index.php file around line 700, but mine only have 100 ones  at most ...

The Eto fix won't work with the latest release we have. Due to security related issues, much of the page rendering logic was changed, and unfortunately the 404 fix we had is no longer valid. It's definitely high up on my to-do list, but unfortunately paying work comes first  Embarrassed
Logged

openagate
Committed to MODx
*****
Posts: 768



« Reply #21 on: Aug 13, 2006, 08:49 PM »

Hi All!

upd:

I created plugin with code:
Code:
if ($modx->documentIdentifier == (id of error page ;) I'm not a php-master, by hands )) {
                 $header = "HTTP/1.0 404 Not Found\n";
                 header($header);
                                                             }

on System Events page selected  Template Service Events->OnWebPagePrerender & Parser Service Events->OnPageNotFound...

it's likely  it works Roll Eyes
« Last Edit: Aug 15, 2006, 07:20 PM by openagate » Logged

vbrilon
Coding Team
*
Posts: 256



« Reply #22 on: Aug 15, 2006, 08:36 PM »

I *think* (and I am not 100% positive since I am not looking at the code now) that by the time that system event gets called, it's too late in some instances to deal with a 404 response.

I'll look into it this weekend and see if I can find where in the code it's happening and just fix it once and for all
Logged

qson
Jr. Member
*
Posts: 17


« Reply #23 on: Aug 22, 2006, 09:05 AM »

Code:
if ($modx->documentIdentifier == (id of error page ;) I'm not a php-master, by hands )) {
                 $header = "HTTP/1.0 404 Not Found\n";
                 header($header);
                                                             }

Modified it a bit...

Here we go:
Code:
if (($modx->documentIdentifier == $modx->config['error_page'])||($modx->Event=='OnPageNotFound')) {
                 $header = "HTTP/1.0 404 Not Found\n";
                 header($header);
}

Now it reads which page is the error page id and returns a 404 header.

Like openagate wrote:
Check the "OnWebPagePrerender" and "OnPageNotFound" events.
« Last Edit: Aug 22, 2006, 02:45 PM by qson » Logged
openagate
Committed to MODx
*****
Posts: 768



« Reply #24 on: Aug 22, 2006, 11:47 AM »

oh, thanx a lot...
Logged

dbowling
Jr. Member
*
Posts: 32



WWW
« Reply #25 on: Aug 28, 2006, 06:41 PM »

Thanks so much, that is great!!!
Logged

lovingmodx
Member
**
Posts: 86


« Reply #26 on: Aug 31, 2006, 09:01 AM »

You can also replace this line in document.parser.class.inc.php

Code:
$header = (($this->documentIdentifier == $this->config['error_page']) && $redirect_error) ? "HTTP/1.0 404 Not Found\n".$header : $header;

with

Code:
$header = ($this->documentIdentifier == $this->config['error_page'] or $redirect_error) ? "HTTP/1.0 404 Not Found\n" : $header;

I am sure the team will fix this on next release. Smiley
Logged
Soda
Testers
*
Posts: 415


Daddy !


WWW
« Reply #27 on: Sep 01, 2006, 03:02 AM »

Hello, I have a solution without a hack (untill it is included in the next release):
create a new plugin,put header("HTTP/1.0 404 Not Found"); in the content and check the event OnPageNotFount

That's all.
Logged

MODx Sites & Prestations: http://dp-site.fr   [Last MODx Site]
MODx Repository: [HOME]  [MetaTagsExtra] / Current Dev: [xFDM]
zi
MODx Special Forces /
Administrator
*
Posts: 2,941


May Peace Be On You


WWW
« Reply #28 on: Sep 01, 2006, 03:15 AM »

Hello, I have a solution without a hack (untill it is included in the next release):
create a new plugin,put header("HTTP/1.0 404 Not Found"); in the content and check the event OnPageNotFount
That's all.

Great!

Thanks for the solution!

regards.

zi
Logged

“Internet Explorer’s CSS rendering: WYSIWTF”. — someone genius
--------------------------------------------------
rthrash
Foundation
*
Posts: 9,269



WWW
« Reply #29 on: Sep 01, 2006, 08:36 AM »

Hello, I have a solution without a hack (untill it is included in the next release):
create a new plugin,put header("HTTP/1.0 404 Not Found"); in the content and check the event OnPageNotFount

Have you been able to confirm whether or not Google likes this in their sitemap service?
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
Pages: 1 [2] 3   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!