Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2007
    Posts
    69
    Thanks
    11
    Thanked 2 Times in 2 Posts

    How to disable the DEFLATE module for a specific directory?

    I am trying to figure out how to disable the DEFLATE module (gzipping) for a specific directory on my server. This is what I have in /etc/httpd/conf/httpd.conf

    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html


    I can add something to my .htaccess file in the specific directory or even add a something to my /vhosts/domain.com/httpdocs/conf/vhosts.conf file. I can't seem to get it to work though. Any suggestions?

  • #2
    Regular Coder
    Join Date
    Jun 2010
    Posts
    132
    Thanks
    8
    Thanked 0 Times in 0 Posts
    (You can see http://www.issociate.de/board/post/4...te_or_dir.html)

    Your Answer is:

    If you added the DEFLATE filter using AddOutputFilter, you can remove it
    using RemoveOutputFilter.

    You can do this for a single file by nesting <Files> within <Directory>.

    For example, this compresses all .php responses except for the response
    from nocompress.php:

    <Directory /var/www/myapp >
    AddOutputFilter DEFLATE .txt .php .htm .html .cfm .xml .css .js
    <Files nocompress.php>
    RemoveOutputFilter .php
    </Files>
    </Directory>

  • #3
    New Coder
    Join Date
    Aug 2007
    Posts
    69
    Thanks
    11
    Thanked 2 Times in 2 Posts
    Hey Tony,

    Thanks for the suggestion but still having no luck. I am wondering if it because I have the my AddOutputFilter DEFLATE in httpd.conf which is the setup all the sites on the server and for some reason it wont let me change those settings somewhere else. Maybe if i add gziping to each site in the vhost.conf file for each site?

  • #4
    Regular Coder
    Join Date
    Jun 2010
    Posts
    132
    Thanks
    8
    Thanked 0 Times in 0 Posts
    I didn't know what is Your right purpose, Your answer might be:

    You could set the environment variable no-gzip for that directory/type of file:

    example:

    # for URL paths that begin with "/foo/bar/" SetEnvIf Request_URI ^/foo/bar/ no-gzip=1 # for files that end with ".jpg" SetEnv no-gzip 1

    You might find You answers at:
    http://serverfault.com/questions/108...ne-set-of-urls
    http://www.howtoforge.com/forums/sho...d.php?p=226659
    http://snippets.dzone.com/posts/show/6086
    http://hype-free.blogspot.com/2008/0...ain-files.html

  • #5
    New Coder
    Join Date
    Aug 2007
    Posts
    69
    Thanks
    11
    Thanked 2 Times in 2 Posts
    I removed my original code from /etc/httpd/conf/httpd.conf and added this to my vhost.conf on this domain

    <Directory "/var/www/rockchurch.com/httpdocs">
    AddOutputFilterByType DEFLATE html txt xml css js php
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    php_admin_value open_basedir none
    php_admin_value safe_mode off
    Options FollowSymLinks
    </Directory>

    <Directory "/var/www/rockchurch.com/httpdocs/tiny">
    RemoveOutputFilter DEFLATE html txt xml css js php
    </Directory>


    And works well. Apparently having it in /etc/httpd/conf/httpd.conf universally adds it to all domains, which is great, but can't be changed in specific directories elsewhere.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •