homepage Welcome to WebmasterWorld Guest from 54.237.54.83
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Questions About Gzip Compression on Apache
Gzip Compression
TeamSDA




msg:4290265
 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




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved