About gzip, mod_deflat...

Status
Not open for further replies.

seif alaya

New Member
Messages
6
Reaction score
0
Points
0
Hello,

I'd like to use the compression to lower the weight of my pages, but despite the answers that say "Yes, it is enabled" and a dozen of tests, it still doesn't work.

So I just want to know if it is really allowed with the freehosting. If it's not, I can stop my tests and give my brain some rest. ;)

Edit --
And please, about the URL rewriting as well.
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
mod_gzip and mod_deflate do not seem to be part of Apache (on Chopin)

My test was to add to .htaccess

Code:
<IfModule mod_gzip.c>
ErrorDocument 404 /error/404.html
</IfModule>

Default x10hosting 404 page was then displayed on my site. Same with mod_deflate.c

But mod_rewrite.c caused my custom 404 page to be displayed.

Yes, mod_rewrite is enabled on all the free servers.

Just add

RewriteEngine on

before your rewrite conditions/rules
 

seif alaya

New Member
Messages
6
Reaction score
0
Points
0
Thanks for your answer and your tests, descalzo.

I am not quite used with the URL rewriting, even if I know it must start in the .htaccess by RewriteEngine on. I am trying to use it to hide the .php extensions but it seems I still have much to learn about this.

I have applied most of the advices gave by Firebug (CSS sprites, hostnames, etc), gzip is no longer my priority, for now...

*gone to learn about url rewriting* :biggrin:
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
If Apache can't gzip, I believe that PHP can. You might want to look into implementing gzip compression from the php perspective. In the meantime you might want to take a look at http://corz.org/serv/tricks/htaccess2.php or many other toturials on mod_rewrite that you can find on google.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
If you merely wish to drop the "php" extension from URLs, you can also turn on content negotiation with "Options +MultiViews" in .htaccess. This also lets you drop extensions for all file types. You can even have files named "foo.html.php" and refer to them simply as "foo". Read "Extentionless URLs" for more on the topic.

I tend to use the rewrite engine to deal with extensions only when I want a resource that results from a script to have more than one representation (i.e. more than one extension type). To do this globally:
Code:
RewriteCond %{REQUEST_FILENAME} (.*)\.(x?html|txt|xml|json)$
RewriteCond %1.php -f
RewriteEngine ^(/?.*)\.(x?html|txt|xml|json) $1.php?fmt=$2 [QSA]
"/foo/bar.txt" gets rewritten to "/foo/bar.php?fmt=txt". I'll usually do this in concert with MultiViews, where the script has a default output type. For example, requesting "/foo/bar" results in HTML.

If Apache can't gzip, I believe that PHP can.
In particular, read up on ob_gzhandler. It takes in to account what content encodings the browser supports.
 
Last edited:

seif alaya

New Member
Messages
6
Reaction score
0
Points
0
Very useful link, xav0989 !

I have tried something yesterday about multiview, misson - but with no success. In fact, I mainly had to spend time removing the "500 error" I had... Just because I was so tired that I uploaded the htaccess at the first level of my directory. ;)

Thanks to all for your help, I appreciate!
 
Status
Not open for further replies.
Top