#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0

    .jgz (gzip) does not work on new host


    Hi I have this in htaccess.
    I have pregzipped the js and css files and renambed to .jgz for better browser compatibility:

    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{REQUEST_FILENAME}.jgz -f
    RewriteCond %{HTTP_USER_AGENT} !MSIE\s[56]\.\d+;\sWindows
    RewriteRule (.*)(\.js|\.css)$ $1$2.jgz [L]
    AddType "application/x-javascript" .js.jgz
    AddType "text/css" .css.jgz
    AddEncoding gzip .jgz

    However this does not work on new host, is there something I can change in new host or is it a problem of the host?

    Thanks,
    Helen
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,128
    Rep Power
    4304
    Do you know which versions of Apache it's worked for and which version this new host is using?

    You can try replacing the two AddType directives with this:
    Code:
    <FilesMatch "\.css\.jgz$">
      ForceType text/css
    </FilesMatch>
    <FilesMatch "\.js\.jgz$">
      ForceType application/x-javascript
    </FilesMatch>
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Originally Posted by Kravvitz
    Do you know which versions of Apache it's worked for and which version this new host is using?

    You can try replacing the two AddType directives with this:
    Code:
    <FilesMatch "\.css\.jgz$">
      ForceType text/css
    </FilesMatch>
    <FilesMatch "\.js\.jgz$">
      ForceType application/x-javascript
    </FilesMatch>
    That did not work
    As per cpanel the new host has apache 2.2.21
    And the old host had 2.2.21

    The same version lol
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    I have another addtyp wich works:
    AddType application/x-httpd-php5 .htm .html

    I have tried without the slashes same as above but it did not work either....
    In the header on the new host I get as answer
    text/plain
    Last edited by helenp; January 27th, 2012 at 11:47 AM.
  8. #5
  9. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,128
    Rep Power
    4304
    I have tried without the slashes same as above but it did not work either....
    Slashes? Do you mean without the quotes?

    I don't know why one would work but not the other, especially on the same version of Apache. Have you tried asking the support staff of your new host?
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Originally Posted by Kravvitz
    Slashes? Do you mean without the quotes?

    I don't know why one would work but not the other, especially on the same version of Apache. Have you tried asking the support staff of your new host?
    yes sorry my english, I mean quotes,
    yes I have asked my host about 10 hours ago and they passed it to higher level, still no anwer.....
    I tried to change the .jgz to .gz and uploading a .gz file of course and then it worked perfectly
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Lol, have ever heard of this, this is hosts answer:
    This is unfortunately not something we will be able to support as our web server does this for you already. Our web server does exactly what you're doing and it's going to be far more efficient. We do not actually run Apache but Litespeed and it has it's own smart compression system in place already. It has a static cache of files it has gzipped in the past so it will be pre gzipped exactly like your implementation after the first visit on the file. It also checks for changes so if you do make a file change it automatically updates it's caches on the next visit. This method is going to be more efficient than yours as it does not run through the rewrite engine to do it.

    All you will need to do is comment out that code and then you'll get the same benefits before and potential for a performance improvement while serving the css and js files as well as various other file types you may be serving which are capable of gzip compression that you are not currently doing

    Will test this, its automatic....
    what I dont understand is this:
    All you will need to do is comment out that code

    suppose he means comment it out on htaccess in case I need it on another host.

    So checking my htacces I wont need the cache stuff either I guess.
    I do want the php cached for a short time and as I have htm treated as php with this:
    AddType application/x-httpd-php5 .htm .html

    So this I keep:
    AddType application/x-httpd-php5 .htm .htm

    <FilesMatch "\.(pl|txt|htm|html|[sf]?cgi|spl)$">
    Header set Cache-Control: "max-age=7200"
    </FilesMatch>

    And below I imagine I wont need
    #<FilesMatch "\.(gif|jpeg|jgz|gz|jpg|js|pdf|css|GIF|png|flv|swf|ico)$">
    #Header set Cache-Control: "max-age=29030400"
    #</FilesMatch>
    #<FilesMatch "\.(js|css|jgz|gz)$">
    #Header append Vary Accept-Encoding
    #</FilesMatch>
    #<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|jgz)$">
    #Header unset Last-Modified
    #</FilesMatch>
    #Header unset ETag
    #FileETag None

    I will do tests

    hmm, looks good, get even smaller pages as the html is compressed, good
    but I do get this in the header:
    Etag "170f-4f211826-0"
    Expires Sat, 04 Feb 2012 07:18:43 GMT
    Last edited by helenp; January 28th, 2012 at 01:30 AM.

IMN logo majestic logo threadwatch logo seochat tools logo