Relative Path for CGI script

Discussion in 'Perl Misc' started by fromero@csudh.edu, Mar 24, 2005.

  1. Guest

    I have several web links which are absolute paths for the cgi scripts,
    e.g. http://whovian.com/cgi-bin/algebra.cgi. How can I write a web
    links which are not absolute but relative. I would like to use the
    same scripts and web page on another server, but not rewrite the links.
     
    , Mar 24, 2005
    #1
    1. Advertising

  2. wrote:

    > I have several web links which are absolute paths for the cgi scripts,
    > e.g. http://whovian.com/cgi-bin/algebra.cgi. How can I write a web
    > links which are not absolute but relative. I would like to use the
    > same scripts and web page on another server, but not rewrite the links.


    It is completely unclear what you are asking but is is clear that your
    question has nothing whatever to do with Perl.

    You appear to be asking how to write a relative URL.

    If you have a page with a URL

    http://www.example.com/this/that/other/page.html

    And you want to link to

    http://www.example.com/this/here/script.cgi

    Then you can use a relative link '../../here/script.cgi' or
    '/this/here/script.cgi'.

    For details read documents about URLs.
     
    Brian McCauley, Mar 24, 2005
    #2
    1. Advertising

  3. Guest

    Write a simple perl program that uses an html parser (unless its
    asp..et all, which you could design a custom parse).
    A few regx and your good to go. You could even make templates, sort of
    like mail-merge then pass in where you want
    it (via cmdline or config) then write out your custom page....
     
    , Mar 25, 2005
    #3
  4. Guest

    The mail-merge would do nice, make a template "html_yourfile" or
    anything text,
    the template contains:

    ..... http://www.example.com/<Tag_Dir_Mine_Path1>/script.cgi .....

    just replace all <Tag_Dir_Mine_Path1> with whats passed in from cmdline
    or set up a config.ini with machine names
    and how you want its paths setup:

    [Machine-1]
    Tag_Dir_Mine_Path1 = ../dir
    Source_Out = //machine1/webroot

    [Machine-2]
    Tag_Dir_Mine_Path1 = ../dir
    Source_Out = //machine2/webroot

    etc ...

    c:\> perl prog.pl /c:config.ini:ALL

    or

    c:\>perl prog.pl ../dir //machine1/webroot
     
    , Mar 25, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    3
    Views:
    19,567
    Sudsy
    Jul 8, 2004
  2. Thomas Guettler
    Replies:
    3
    Views:
    761
    Andrei
    Oct 27, 2003
  3. Oren
    Replies:
    1
    Views:
    551
    Michael D. Ober
    Apr 29, 2007
  4. Nigel Wilkinson
    Replies:
    2
    Views:
    389
    Nigel Wilkinson
    Jul 25, 2005
  5. kath
    Replies:
    4
    Views:
    647
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page