httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Short <...@benshort.co.uk>
Subject Re: [users@httpd] Pre compressed css and javascript
Date Fri, 08 Oct 2010 07:51:59 GMT
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@benshort.co.uk> wrote:
> I got it all working. My configuration is shown below. Thanks for the help.
>
> <VirtualHost *:80>
>        ServerAdmin ben.short@nexusalpha.com
>        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@gmail.com> 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@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message