Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Relative Path for CGI script

1 view
Skip to first unread message

fro...@csudh.edu

unread,
Mar 24, 2005, 3:27:26 AM3/24/05
to
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.

Brian McCauley

unread,
Mar 24, 2005, 3:36:19 AM3/24/05
to
fro...@csudh.edu wrote:

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.

rob...@yahoo.com

unread,
Mar 25, 2005, 12:45:39 AM3/25/05
to
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....

rob...@yahoo.com

unread,
Mar 25, 2005, 1:10:12 AM3/25/05
to
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

0 new messages