The following is taken from a thread on SEOmoz.org that I have been participating in:


Quote Originally Posted by Me
Interesting article, but are you sure you can force a 200 HTTP response from a custom error page?

I've tried this on two sites and, while I can force a 301 without any problems, in the case of a 200 I simply get a 404.

Perhaps there is some server configuration to alter in order to allow this to work?
Quote Originally Posted by OP
Yes...you must set the status in the header BEFORE outputting any HTML at all to the client though.
Quote Originally Posted by Me
That's what I've been doing.

Exact contents of my test custom 404 page:

PHP Code:
<?php
  header
('HTTP/1.1 200 OK');
?>

Bailed!
Outcome:
URL=http://www.board-crazy.co.uk/nonexistentpage
Result code: 404 (NotFound / Not Found)

Obviously I don't disbelieve you, just trying to figure out what your server is doing differently!
Quote Originally Posted by OP
OK, figured out how to make this work in Apache. Here's my 404 page that returns a 200. The key is to call ob_start() and ob_end_flush() to make sure the header bit with the status is NOT sent before we can override it with our header() call:

PHP Code:
<?php    
  ob_start
();    
  
header('HTTP/1.1 200 OK'true200);
?>

[snipping out the HEAD, BODY tag etc. to avoid getting important stuff lost in the noise....]

<?php     
  ob_end_flush
(); 
?>
As you can see, in this convo I'm having quite a lot of difficulty achieving an effect that the blog post in question talks about, namely forcing a 200 HTTP response from a custom 404 page. This is for the purposes of custom URL rewriting.

The poster has been very helpful in following up my comments but I've now tried the last suggestion using ob_start and ob_end_flush and still can't get it to work.

Does anyone here know why this might work for some sites but not others? Any alternative suggestions for getting it to work?