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