Re: Pre compressed css and javascript

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After more investigation the previous configuration did not actually
work correctly.  The following does.

AddEncoding gzip .jgz
AddType application/javascript .jgz
AddEncoding gzip .cgz
AddType text/css .cgz

RewriteCond %{REQUEST_URI} ^(.*).js$
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.jgz -f
RewriteCond %{HTTP_USER_AGENT} !Safari [OR]
RewriteCond %{HTTP_USER_AGENT} Chrome
RewriteRule ^(.*)$ $1.jgz [QSA,L]

RewriteCond %{REQUEST_URI} ^(.*).css$
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.cgz -f
RewriteCond %{HTTP_USER_AGENT} !Safari [OR]
RewriteCond %{HTTP_USER_AGENT} Chrome
RewriteRule ^(.*)$ $1.cgz [QSA,L]




On 6 October 2010 13:00, Ben Short <ben@xxxxxxxxxxxxxx> wrote:
> I got it all working. My configuration is shown below. Thanks for the help.
>
> <VirtualHost *:80>
>        ServerAdmin ben.short@xxxxxxxxxxxxxx
>        DocumentRoot
> "/usr/local/apache2/docs/www.journeycheck.southwesttrains.co.uk/"
>        ServerName www.journeycheck.southwesttrains.co.uk
>
>        RewriteEngine On
>        RewriteLog "logs/rewrite.log"
>        RewriteLogLevel 5
>
>        RewriteCond %{REQUEST_URI} !^(.*)/resources/*
>        RewriteRule ^(.*)$ /southwesttrains$1 [QSA,NC,PT,L]
>
>        RewriteCond %{REQUEST_URI} !^(.*).(js|css)$
>        RewriteRule ^(.*)$ $1 [QSA,L]
>
>        RewriteCond %{HTTP:Accept-encoding} gzip
>        RewriteCond %{HTTP_USER_AGENT} !Safari
>        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.gz -f
>
>        RewriteCond %{REQUEST_URI} !^(.*).js$
>        AddEncoding gzip .gz
>        AddType application/x-javascript .gz
>        RewriteRule ^(.*)$ $1.gz [QSA,L]
>
>        RewriteCond %{REQUEST_URI} !^(.*).css$
>        AddEncoding gzip .gz
>        AddType text/css .gz
>        RewriteRule ^(.*)$ $1.gz [QSA,L]
>
>        <Directory
> /usr/local/apache2/docs/www.journeycheck.southwesttrains.co.uk>
>                Options +MultiViews
>                AllowOverride None
>                Order allow,deny
>                allow from all
>        </Directory>
>
>        ErrorLog "logs/www.journeycheck.southwesttrains.co.uk-error_log"
>        CustomLog
> "logs/www.journeycheck.southwesttrains.co.uk-access_log" common
>
>        ExpiresActive On
>        ExpiresDefault "access plus 1 days"
>        ExpiresByType image/gif "access plus 1 days"
>        ExpiresByType image/png "access plus 1 days"
>
>
>        JKMount /* web4
>        JKUnmount /resources/* web4
>        JKUnmount /manager web4
>
> </VirtualHost>
>
>
>
> On 4 October 2010 16:41, Eric Covener <covener@xxxxxxxxx> wrote:
>>> But.. what about Options +MultiViews?
>>> http://httpd.apache.org/docs/current/content-negotiation.html
>>
>> FWIW I think you need the "MutlViewsMatch any" and make sure your
>> requests are all for "foo" and not "foo.js", otherwise it doesn't kick
>> in (from my recollection).
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
>>   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
>> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>>
>>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux