Welcome to WebmasterWorld Guest from 54.226.241.8

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Compression and cache

     

qimqim

4:34 pm on Feb 26, 2014 (gmt 0)



Hi

I've placed the following code at the very end of my htaccess file but it does not do anything..

According to JustHost mod_deflate is enabled


# 5 Set Expires Headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Jan 2015 20:00:00 GMT"
</FilesMatch>

# 6 Set the cache-control max-age
# 1 year
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
# 2 DAYS
<FilesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>
# 4 HOURS
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=14400, must-revalidate"
</FilesMatch>


#7 compress text, html, javascript, css, xml:

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript


Any help appreciated.

Thank you

phranque

5:53 pm on Feb 26, 2014 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



try using mod_expires:
http://httpd.apache.org/docs/current/mod/mod_expires.html [httpd.apache.org]

qimqim

6:05 pm on Feb 26, 2014 (gmt 0)



I don't know if it's enabled, but my main problem at the moment is the compression, as I don't know if the cache is working or not.

Do you know how I can check that?

Thank you phranque

phranque

8:30 pm on Feb 26, 2014 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



these are the compression-related directives i typically use:

# Various rewrite rules.
RewriteEngine on

# Rules to serve gzip-compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.
#
# If the client accepts gzip and compressed CSS and JS files exist, internally rewrite and serve them with
# proper Content-Type headers and set the no-gzip variable to prevent double-encoding
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -s
RewriteCond $2->text/css ^css->(.+)$ [OR]
RewriteCond $2->text/javascript ^js->(.+)$
RewriteRule ^(.+\.(css|js))$ $1.gz [T=%1,E=no-gzip:1,L]


# compress these text/* MIME types
AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript application/x-javascript text/xml application/xml application/xhtml+xml application/json


# server proper headers for precompressed css & javascript
<FilesMatch "\.(css|js)\.gz$">
# Serve correct encoding type.
Header append Content-Encoding gzip

# [Vary: Accept-Encoding] means a proxy server will cache both gzipped and uncompressed versions and serve the correct version based on the Accept-Encoding request header
# [Vary: User-Agent] means a proxy server will cache both gzipped and uncompressed versions and serve the correct version based on the User-Agent request header
# No Vary headers should be sent for MSIE-sourced requests

# Force proxies to cache gzipped & non-gzipped css/js files separately.
Header append Vary "Accept-Encoding"
Header append Vary "User-Agent"
BrowserMatch "MSIE" force-no-vary
</FilesMatch>


# server proper headers for uncompressed css & javascript
<FilesMatch "\.(css|js)$">

# [Vary: User-Agent] means a proxy server will cache both gzipped and uncompressed versions and serve the correct version based on the User-Agent request header
# No Vary headers should be sent for MSIE-sourced requests

# Force proxies to cache gzipped & non-gzipped css/js files separately.
Header append Vary "User-Agent"
BrowserMatch "MSIE" force-no-vary
</FilesMatch>

phranque

8:37 pm on Feb 26, 2014 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



one way to check if the cache is working is to use the Live HTTP Headers FF plugin and check the HTTP Request and Response headers with a clear cache and again with a primed cache.

qimqim

8:41 pm on Feb 26, 2014 (gmt 0)



Hi, I'm waiting for JustHost to answer a couple of questions about what they have installed, but they already told me that gzip is not recommended beacuse being a shared IP they sometimes have to turn it off if someone misbehaves.

I'll come back on this

Thanks

qimqim

4:06 am on Feb 28, 2014 (gmt 0)



Hi

I've finally got a reply from the host. Yes the mod_deflate is installed but it has a "c" in front. What does that mean?

mod_deflate.c

phranque

10:02 am on Feb 28, 2014 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



that means the module is written in C.

qimqim

10:18 am on Feb 28, 2014 (gmt 0)



Hi phranque

Does that mean I cannot use it, or do that I need a different code format to the one above? I'm refrerring now to mod_deflate

qimqim

11:58 am on Feb 28, 2014 (gmt 0)



Hi, again

I've placed this in the htaccees file

<ifModule mod_deflate.c>
<filesMatch "\.(js|css|html|php)$">
SetOutputFilter DEFLATE
</filesMatch>
</ifModule>


and this result in
http://www.microsoft.com/search/tools/default.aspx

HTTP compression and conditional GET results

URL: http://example.net

HTTP status code: 304 Not Modified

HTTP conditional GET: enabled
HTTP compression: not enabled (HTTP compression can be enabled for non-304 URLs)

HTTP headers:
Connection: Keep-Alive
Keep-Alive: timeout=10, max=30
Vary: Accept-Encoding
Cache-Control: max-age=864000
Date: Fri, 28 Feb 2014 12:05:32 GMT
Expires: Mon, 10 Mar 2014 12:05:32 GMT
Server: Apache


I don't understand the difference between

HTTP conditional GET: enabled
HTTP compression: not enabled

Could you explain, plesae, if compression is enabled or not?

What I am after is html compression.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month