View Single Post

  #5 (permalink)  
Old 05-24-2008, 07:25 PM
mumuri mumuri is offline
Junior Member
User
 
Join Date: May 2008
My distro: Debian
Posts: 11
Rep Power: 0
mumuri is on a distinguished road
Default

ok i set up this
mypage.php
Code:
<?php
header("HTTP/1.1 200 OK",true,200);
?>
hello world, postnuke
Code:
~# curl http://shopog.com/mypage.php -I
HTTP/1.1 200 OK
Date: Sat, 24 May 2008 12:52:58 GMT
Server: Apache
X-Powered-By: PHP/4.4.8
Vary: Host
Content-Type: text/html

~# curl http://shopog.com/seo-test-error-document.html -I
HTTP/1.1 404 Not Found
Date: Sat, 24 May 2008 12:53:04 GMT
Server: Apache
X-Powered-By: PHP/4.4.8
Vary: Host
Content-Type: text/html
so my theory is bad ^^

why a 200ok is send even if it s a 404 ?

will look at wordpress error file

EDIT : i ve look and extrated all redirection stuff of wp, then i created this file
Code:
<?php
function absint( $maybeint ) {
	return abs( intval( $maybeint ) );
}
function get_status_header_desc( $code ) {
	global $wp_header_to_desc;

	$code = absint( $code );

	if ( !isset( $wp_header_to_desc ) ) {
		$wp_header_to_desc = array(
			100 => 'Continue',
			101 => 'Switching Protocols',

			200 => 'OK',
			201 => 'Created',
			202 => 'Accepted',
			203 => 'Non-Authoritative Information',
			204 => 'No Content',
			205 => 'Reset Content',
			206 => 'Partial Content',

			300 => 'Multiple Choices',
			301 => 'Moved Permanently',
			302 => 'Found',
			303 => 'See Other',
			304 => 'Not Modified',
			305 => 'Use Proxy',
			307 => 'Temporary Redirect',

			400 => 'Bad Request',
			401 => 'Unauthorized',
			403 => 'Forbidden',
			404 => 'Not Found',
			405 => 'Method Not Allowed',
			406 => 'Not Acceptable',
			407 => 'Proxy Authentication Required',
			408 => 'Request Timeout',
			409 => 'Conflict',
			410 => 'Gone',
			411 => 'Length Required',
			412 => 'Precondition Failed',
			413 => 'Request Entity Too Large',
			414 => 'Request-URI Too Long',
			415 => 'Unsupported Media Type',
			416 => 'Requested Range Not Satisfiable',
			417 => 'Expectation Failed',

			500 => 'Internal Server Error',
			501 => 'Not Implemented',
			502 => 'Bad Gateway',
			503 => 'Service Unavailable',
			504 => 'Gateway Timeout',
			505 => 'HTTP Version Not Supported'
		);
	}

	if ( isset( $wp_header_to_desc[$code] ) )
		return $wp_header_to_desc[$code];
	else
		return '';
}

function status_header( $header ) {
	$text = get_status_header_desc( $header );

	if ( empty( $text ) )
		return false;

	$protocol = $_SERVER["SERVER_PROTOCOL"];
	if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
		$protocol = 'HTTP/1.0';
	$status_header = "$protocol $header $text";
	if ( function_exists( 'apply_filters' ) )
		$status_header = apply_filters( 'status_header', $status_header, $header, $text, $protocol );

	if ( version_compare( phpversion(), '4.3.0', '>=' ) )
		return @header( $status_header, true, $header );
	else
		return @header( $status_header );
}
	header('Content-Type: text/plain');
	status_header('200');
	exit;
?>
the result are the same, so i think there is something in the server configuration who doesn't allow this

will look at that

Last edited by mumuri; 05-24-2008 at 07:53 PM..
Reply With Quote