[wp-hackers] Re: Why, 200 OK...?!? Why?!?

Florian Kriener florian at leflo.de
Mon Sep 25 17:21:50 GMT 2006


On Monday 25 September 2006 18:34, Trevor Turk wrote:
> If anybody has the energy, try putting this code into your header.php file
>
> if (isset($_GET['test'])) { $url = get_bloginfo('url'); wp_redirect($url);
> exit; }
>
> ... And then visit your blog like so:
>
> http://www.example.com/?test=1
>
> ... And you can see what I mean.

It's a bug, wordpress calls status_header(200) in WP::handle_404 which is 
called from WP::main.

status header(200) prints the headers:

HTTP/1.1 200 OK
Status: 200 OK

But if you want to make a redirect you need status code 301 or 302.

Put status_header(301) or 302 before wp_redirect(..) and it works.

The bug is, that status_header(30{1,2}) should be in wp_redirect.

-- 
name....Florian Kriener
email...florian at leflo.de
site....http://leflo.de/


More information about the wp-hackers mailing list