WordPress.org

Ready to get started?Download WordPress

Forums

Compression help (1 post)

  1. samq@labelmedia.co.uk
    Member
    Posted 3 years ago #

    I have wordpress running a 1&1 server. To add compression to my to site I added :

    AddType x-mapp-php5 .php .shtml .html .htm .txt .js .css to my htaccess.

    Then I added the following into a php.ini file:

    output_handler=ob_gzhandler
    auto_prepend_file=/kunden/homepages/27/d292845089/htdocs/PelicanFly/headers.php

    I then created a file called header.php with this included:

    <?
    $pathinfo=pathinfo($_ENV['SCRIPT_FILENAME']);
    $extension=$pathinfo['extension'];
    $offset = 60 * 60 * 24 * 30;
    if($extension=='css'){
    header('Content-type: text/css; charset=utf-8');
    header("Expires: ".gmdate("D, d M Y H:i:s", time() + $offset)." GMT");
    header("Vary: Accept-Encoding");
    }
    if($extension=='js'){
    header('Content-type: text/javascript; charset=utf-8');
    header("Expires: ".gmdate("D, d M Y H:i:s", time() + $offset)." GMT");
    header("Vary: Accept-Encoding");
    }
    ?>

    This compressed everything fine but it breaks my wordpress admin. It basically looks like the styles are broken.

    If i remove .css from
    AddType x-mapp-php5 .php .shtml .html .htm .txt .js .css

    so:

    AddType x-mapp-php5 .php .shtml .html .htm .txt .js .

    It works fine because it is not compressing the css. I found a half solution to add:

    define('WP_DEBUG', true);

    to my wp-config file which fixes the syles but ofcourseshows all the debug logs in my wordpress admin. Can anyone help? I'm getting short on hair.

    Muchos gracias.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by samq@labelmedia.co.uk
  • This topic is not resolved
  • WordPress version: 3.1