Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

•Re: Trailing slash problem with mod_perl

by merlyn (Sage)
on Sep 28, 2004 at 16:39 UTC ( [id://394662]=note: print w/replies, xml ) Need Help??


in reply to Trailing slash problem with mod_perl

I explain how I handled this in my mod_perl Picture Handler column. If your handler gets a directory for a URI that doesn't end in slash, it must decline it unless it's prepared to handle the redirect that mod_dir normally does. In short:
use Apache::Constants qw(:common DIR_MAGIC_TYPE); ... sub handler { my $r = shift; return DECLINED if $r->content_type eq DIR_MAGIC_TYPE and not $r->uri =~ m{/$}; ... }
If you don't want to handle directories at all, leave off the latter part of the check: just return DECLINED for anything that is DIR_MAGIC_TYPE.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://394662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-03-29 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found