Jump to content

Gzip compression with php - any way to exclude certain files by name?


Bottyz

Recommended Posts

Hey all,

 

I prepend and append php files with gzip compression code. Currently i can achieve this with the code below which will prepend/append every php file, however, i want to be able to exclude certain php pages from this.

 

The current code in my .htaccess is this:

php_value auto_prepend_file begin_gzip.php
php_value auto_append_file end_gzip.php

 

Which obviously compresses all php files. The begin_gzip.php is as follows:

 

<?php ob_start("ob_gzhandler"); ?>

 

and the end_gzip.php is:

 

<?php ob_flush(); ?>

 

The pages i want to exclude contain php download scripts which stop working with the compression enabled. So is there a way to exclude these files by name or am i going to have to add the begin/end code to each individual php page i want to compress?

 

Any help would be much appreciated as i've exhausted google and i'm stuck now.

Link to comment
Share on other sites

You may be able to use filesmatch:

<FilesMatch ^(these|file|names|are|excluded)\.php$>
   #Disable prepend for these scripts
</FilesMatch>

 

I'm too tired to figure anything else, but this isn't really PHP rather a .htaccess question.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.