> I'm reading my Apache bible and the section on MIME types and my
> question is: Is there a way to modify the htaccess file so that
> regardless of the file requested (".gif", ".wav", ".jpg", etc.) they
> would receive a file recognizable as an html document or a plain
> text file when clicked on?

well, I'm not sure exactly what you're after, but I run this
PerlFixupHandler on a Cobalt where I don't have the ability to really
get at the phases the way I want to (through the AddHandler directive
and so on, which is probably the most proper way to do it)...

package Custom::Unscript;

use Apache::Constants qw(OK DECLINED);
use strict;

sub handler {

  my $r = shift;

  my ($extension) = $r->filename =~ m!(\.[^.]+)$!;

  # un-script a bunch of stuff
  if ($extension eq '.pl'   ||
      $extension eq '.PL'   ||
      $extension eq '.html' ||
      $extension eq '.ksh'  ||
      $extension eq '.ppm'  ||
      $extension eq '.xml'  ||
      $extension eq '.xls'  ||
      $extension eq '.rss'       ) {
    $r->content_type('text/plain');
    $r->handler('default-handler');
    return OK;
  }

  return DECLINED;
}
1;

Reply via email to