Hi, I'm using the 404.php template to deal with a strange Request URI of the form
blog.com/foo/www.example.org
Since I've not found a way to deal with it with static pages, I rely on 404.php and access directly $_SERVER['REQUEST_URI'], if '/foo/' is found I show something, the default 404 otherwise. But in that case I need to send back a 200 OK instead of a 404, do you know a way to do this? May this filter be correct, to be put in functions.php?
add_filter( 'status_header', 'fxfx_hack_404', 10 );
function fxfx_hack_404( $c ) {
if( strpos($_SERVER['REQUEST_URI'],'/foo/') !== false ) {
$header = '200';
$text = get_status_header_desc( $header );
$protocol = $_SERVER["SERVER_PROTOCOL"];
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
$protocol = 'HTTP/1.0';
return "$protocol $header $text";
}
else
return $c;
}
Or do you know a cleanr solution to this?
Thanks.