Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javescript compression in .htaccess #1592

Closed
sheixt opened this issue Sep 3, 2014 · 2 comments
Closed

Javescript compression in .htaccess #1592

sheixt opened this issue Sep 3, 2014 · 2 comments

Comments

@sheixt
Copy link

sheixt commented Sep 3, 2014

I've used the 'compression' section of the .htacess file & noticed (thanks to gzipwtf.com) that the Javascript compression doesn't seem to work. It would seem there is a missing reference to text/javascript.

Here is the updated code snippet that I used, hope it helps:

<IfModule mod_deflate.c>

    # Force compression for mangled headers.
    # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
    <IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ 

HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        </IfModule>
    </IfModule>

    # Compress all output labeled with one of the following MIME-types
    # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
    #  and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
    #  as `AddOutputFilterByType` is still in the core directives).
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE application/atom+xml \
                                      application/javascript \
                                      application/json \
                                      application/rss+xml \
                                      application/vnd.ms-fontobject \
                                      application/x-font-ttf \
                                      application/x-web-app-manifest+json \
                                      application/xhtml+xml \
                                      application/xml \
                                      font/opentype \
                                      image/svg+xml \
                                      image/x-icon \
                                      text/css \
                                      text/javascript \
                                      text/html \
                                      text/plain \
                                      text/x-component \
                                      text/xml
    </IfModule>

</IfModule>
@alrra
Copy link
Member

alrra commented Sep 3, 2014

I've used the 'compression' section ... that the Javascript compression doesn't seem to work

@sheixt As far as I can tell, that is because you didn't included the "media types" section, more specifically, this line.

@sheixt In the future please open issues regarding the .htaccess file in the Apache Server Configs repository. Thanks!

@sheixt
Copy link
Author

sheixt commented Sep 3, 2014

Oops, my bad! Will do :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants