Sending compressed HTML/JS/CSS pages

zardiw

Perch
I heard a rumor that if webpages are compressed before being delivered, it would save mobile users some time......

I tried to add some lines to my .htaccess file to do this.....but the server didn't like me afterwards, so I took them out.

Any info on doing this new fangled compression stuff?

z
 
On a number of servers compression is already enabled and on, the htacess method should also work, but it is super picky about syntax and all, so even if minor error it would come back at you with error/blank page. You have a ticket about which domain? One of linux guys can take a look.
 
Thank you Stephen!!

Website is DDAmanda.com

This is what I tried to add to my .htaccess file

# compress text, HTML, JavaScript, CSS, and 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
# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

Here's another version I found:

# 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

# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>

But I'd actually rather use GZip than Deflate.......fwtfw

Also I'm on a semi dedicated server...........

HEY.....I just found this........gonna try it:

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>


z
 
Last edited:
WAITTTTTTTTTTTT

Found a different site that says it's compressed:

BUT:

OK.......That site is being blocked by the server.......notice the 475 byte length.......that's cause I DENY certain IP addresses and give them a fake 404 page......

http://www.gziptest.com/

Gzip Test : ddamanda.com
upload_2016-9-26_10-39-6.png YES, it's GZIP enabled!
Technical details:
Date : Mon, 26 Sep 2016 17:37:55 GMT

Server : Apache

Last-Modified : Mon, 11 Jan 2016 23:44:28 GMT

ETag : "1ca0f8-1db-52917848e35fa"

Accept-Ranges : bytes

Content-Length : 475

Connection : close

Content-Type : text/html


z
 
Last edited:
We recommend you to switch this website to a latest available PHP version 5.5 and then check compression.
 
This site is on a Semi Dedicated Server.........how do I switch to PHP 5.5.......that's your job correct?

Ans how does the PHP version affect .htaccess directives to Apache?

I guess I should put in a Support Ticket............just wanted to make others aware that their sites can load faster on mobile devices with compression.........

z
 
Back
Top