Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Casey Bisson

    (@misterbisson)

    It looks like apache_response_headers() isn’t returning the content-type header, but headers_list() does.

    I’ve solved the problem by changing these lines:

    if ( function_exists( 'apache_response_headers' ) ) {
    	$cache['headers'] = apache_response_headers();

    To something like this:

    if ( function_exists( 'headers_list' ) ) {
    	$cache['headers'] = headers_list();

    yups. it broke robots.txt if i generate it via wordpress engine.
    so i add some codes as suggested by misterbisson :

    $cache['headers']= array();
    if ( function_exists( 'apache_response_headers' ) ) $cache['headers'] = array_merge($cache['headers'], apache_response_headers());
    if ( function_exists( 'headers_list' ) ) {
    	$heads=	headers_list();
    	if (is_array($heads))
    	foreach ($heads as $ahead) {
    		list($head_name, $head_value)= explode(":", $ahead);
    		if ($head_name) $cache['headers'][$head_name]= trim($head_value);
    	}
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Batcache ignores content type header, sends everything as text/html’ is closed to new replies.