From 3f175aab95c0792db1c15d88767a8b7e681294e8 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Thu, 7 Nov 2013 10:06:49 +0000 Subject: [PATCH] fix 404 header status --- wp-ffpc-acache.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wp-ffpc-acache.php b/wp-ffpc-acache.php index 5076f23..5325aee 100644 --- a/wp-ffpc-acache.php +++ b/wp-ffpc-acache.php @@ -116,8 +116,8 @@ foreach ( $wp_ffpc_keys as $internal => $key ) { /* 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 @@ function wp_ffpc_callback( $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 @@ function wp_ffpc_callback( $buffer ) { $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;