Home Forums Archived Forums Weaver II Theme Weaver II Pro I need to add some code to the top of the page. Which file do I select?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #20039

    I need to speed up my site.  I need to enable gzip compression. Hostgator, my hosting company suggest this:

    Add the following code to the top of your HTML or PHP page:

     <?php if (substr_count($_SERVER[‘HTTP_ACCEPT_ENCODING’], ‘gzip’)) ob_start(“ob_gzhandler”); else ob_start(); ?>
    Which file do I select in editor so that I can add the code to it?

    Update: I have actually resolved this matter by adding code to the site’s htaccess file as recommended by Hostgator as an alternative method. So thanks for looking at the question if you did. 

    I added the following code:

    # compress text, html, javascript, css, xml:
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    # Or, compress certain file types by extension:
    <files *.html>
    SetOutputFilter DEFLATE

    I accessed the htaccess file via cpanel.


    Thanks for the question, and the follow up.

    If you had wanted to add the PHP code, you could make a child theme and add the code to the theme’s header.php file.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘ Weaver II Pro’ is closed to new topics and replies.