• Resolved Funkphenomenon

    (@funkphenomenon)


    I used Matt’s solution in topic 16804 to turn WP’s XHTML into HTML.

    This works fine, but it conflicts when I turn on WP’s gzip compression:

    Warning: ob_start(): output handler 'ob_gzhandler' cannot be used twice (...)

    I also tried adding some lines in .htaccess to turn on gzip compression:

    <FilesMatch ".(php|html?)$">
    php_value zlib.output_compression 4096
    </FilesMatch>

    I had the impression this had worked before, but apparently it doesn’t work (anymore?) for some reason: no compressed files (XHTML to HTML works fine). Adding the following code also didn’t work:

    <?php ob_start( 'ob_gzhandler' ); ?>

    Is there a way to compress my PHP and HTML files, while still converting XHTML to HTML?

Viewing 1 replies (of 1 total)
  • Thread Starter Funkphenomenon

    (@funkphenomenon)

    To apply gzip-compression AND convert XHTML to HTML, someone at another forum gave me the following code:

    <?php
    function make_html($page) {
    if (strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip")!==false) {
    header("Content-Encoding: gzip");
    return gzencode(str_replace(' />', '>', $page));
    } else {
    return str_replace(' />', '>', $page);
    }
    }
    ob_start('make_html');
    ?>

    This works like a charm!

Viewing 1 replies (of 1 total)
  • The topic ‘XHTML to HTML plus gzip compression?’ is closed to new replies.