fix 404 header status
Peter Molnar peter.molnar2@booking.com
Thu, 07 Nov 2013 10:06:49 +0000
1 files changed,
10 insertions(+),
10 deletions(-)
jump to
M
wp-ffpc-acache.php
→
wp-ffpc-acache.php
@@ -116,8 +116,8 @@
/* serve cache 404 status */ if ( isset( $wp_ffpc_values['meta']['status'] ) && $wp_ffpc_values['meta']['status'] == 404 ) { header("HTTP/1.1 404 Not Found"); - flush(); - die(); +// flush(); +// die(); } /* server redirect cache */@@ -253,13 +253,8 @@ return $buffer;
} } - if ( is_404() ) { + if ( is_404() ) $meta['status'] = 404; - header("HTTP/1.1 404 Not Found"); - flush(); - die(); - } - /* redirect page */ if ( $wp_ffpc_redirect != null)@@ -309,8 +304,13 @@
$wp_ffpc_backend->set ( $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_meta'] ) , $meta ); $wp_ffpc_backend->set ( $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_data'] ) , $buffer ); - /* vital for nginx, make no problem at other places */ - header("HTTP/1.1 200 OK"); + if ( $meta['status'] == 404 ) { + header("HTTP/1.1 404 Not Found"); + } + else { + /* vital for nginx, make no problem at other places */ + header("HTTP/1.1 200 OK"); + } /* echoes HTML out */ return $buffer;