Finding a cgi script in a directory tree

Discussion in 'Apache' started by andyaim, Jun 28, 2010.

  1. #1
    Hi All,

    I am working on a solution where the user only specifies the name of the cgi script after the base url and not the exact location of the script which could live in any of the sub directories under the script directory tree such as:

    cgi-bin/car-app/car.cgi
    cgi-bin/plane-app/plane.cgi
    cgi-bin/plane-app/wings/wing.cgi

    The user would request the cgi scripts in the following manner by only providing the cgi script name:

    myapp/cgi-bin/car.cgi
    myapp/cgi-bin/plane.cgi
    myapp/cgi-bin/wing.cgi

    So as you can see the subdirectories are completely eliminated form the input url and my rewrite configuration needs to be smart enough to travers everything under the cgi-bin tree to find the script that is required.

    So my question is, can that be done at all in this flexible manner by using the rewrite-mode? if so can someone please point me to an example or the right direction?

    Thanks very much in advance,
    Andy
     
    andyaim, Jun 28, 2010 IP
  2. esupportsnet

    esupportsnet Greenhorn

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    Hello,

    Can you please explain the above thing through URL that user is trying to access and the one he wants to get?
     
    esupportsnet, Jun 29, 2010 IP
  3. andyaim

    andyaim Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sure, it will be like the following:

    http://myapp/cgi-bin/car.cgi redirects to http://myapp/cgi-bin/car-app/car.cgi
    http://myapp/cgi-bin/plane.cgi redirects to http://myapp/cgi-bin/plane-app/plane.cgi
    http://myapp/cgi-bin/wing.cgi redirects to http://myapp/cgi-bin/plane-app/wings/wing.cgi

    Thanks,
    Andi
     
    andyaim, Jun 29, 2010 IP