Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

How to identify if URL is mod_perl handler

by atemon (Chaplain)
on Oct 29, 2012 at 19:24 UTC ( [id://1001409]=perlquestion: print w/replies, xml ) Need Help??

atemon has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

Is it possible to identify if a url is a mod_perl handler in either mod_rewrite or in PerlTransHandler, if yes, how ?

I know that I can use -l,-f and -d to check existence of link, file or directory on disk via mod_rewrite and -f & -d in perl. But these checks will return false for mod_perl handlers, but URL is valid.

Cheers !

--VC
Indian Stars Wallpapers

Replies are listed 'Best First'.
Re: How to identify if URL is mod_perl handler
by sundialsvc4 (Abbot) on Oct 29, 2012 at 20:21 UTC

    Do you own the code in question, or are you trying to divine the workings of someone else’s site as a “black box?”

    A URL is intended to be a “resource locator,” nothing more or less, such that you ought not be able to determine how the data is served by any examination of the output.   If you have access to the Apache configuration files, there are so many possible variations that a site-designer could have resorted to that you will have to, I think, trace through them example-by-example to determine how any particular one of them “shakes out.”

      Hi,

      I get full access to the code, but my boss doent want to retun a 404, instead he wish to return a 301 or 302 for any page that doesn't exist after checking some conditions.

      For example, all 404 from a sub directory must be redirected to index page of that directory. ie, any 404 from directory http://www.example.com/gallery should load http://www.example.com/gallery/index.html or simillar.

      Cheers !

      --VC
      Cute Wallpapers

        vcTheGuru:

        Gah! I hate it when people "help" me like that. It breaks the model of the web. If a page doesn't exist, I want to know about it--but the "I" in question is one of my scripts, not me personally. If I get a 404, then I can recognize the condition and continue. My scripts, however, aren't clever enough to do so. If instead someone "helpfully" redirects me to something else, then I can't reliably detect the condition. (My home ISP does that to me, and it gripes me to no end.)

        If you're going to do something like that, I'd suggest making a 404 page that gives you the index page of the directory, instead. That way, it can be detected more easily, *and* allow people to find what they're looking for.

        </rant>

        Update: Having said that, getting the 301 or 302 code would be fine, too. Anything's better than some odd page with a 2xx status code.

        Update: Added sentence starting "My scripts"

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-24 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found