Welcome to WebmasterWorld Guest from 54.234.63.187

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Questions About Gzip Compression on Apache

Gzip Compression

     

TeamSDA

5:51 pm on Mar 31, 2011 (gmt 0)



Hi,

So over the past couple days I've been putting together my .htaccess file. Below is what I have so far. The purpose is to redirects non-www. to www, redirects www.example.com/index.html to the root (www.example.com) and take all 404 Errors to the custom error page. (Thanks to G1smd)


ErrorDocument 404 /errorpage.html

RewriteEngine on

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html(\?[^\ ])?\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html$ http://www.example.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]



Now I need to add gzip compression. I've compiled several different way to achieve this. Activating through .htaccess file or .php. First does anyone have any suggestions as to which one would be the best for Apache server with less then 1000 visits a day. Below is some over the ways I've tried with .htaccess.


CODE FOR THE .HTACCESS FILE

This code is working to compress html but won't work for php:

<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>


G1smd mentioned on a different post not to use AddOutputFilterByType on Apache. SEOtop10 gave me this piece of code, but I cant get it to work:

<IfModule mod_filter.c>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $\btext/(html|plain|css|javascript|xml|x-component)\b
FilterProvider COMPRESS DEFLATE resp=Content-Type $\bapplication/(javascript|json|xml|x-javascript)\b
FilterChain COMPRESS
FilterProtocol COMPRESS change=yes;byteranges=no
</IfModule>



In conclusion, can anyone give me any pointers as to which compression style I should choose and how to configure it into my code above if using .htaccess to compress?

1. Deflate
2. Gzip
2. PHP


Thank you for helping me out,

Christian

SEOtop10

9:17 am on Apr 6, 2011 (gmt 0)

10+ Year Member



As mentioned in the other thread, please run your php file through a server header tool and report what is the server response header. You will be looking for content type.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month