View Full Version : newbie : setting up cgi-bin path on html page

08-05-2002, 11:39 AM
I need to know how to write the path to my cgi-bin on the html page that will call the script.
my account is set up as follows :

of course, if I write on the index file:
<a href=/cgi-bin/script.cgi>
it's not going to work, since it not at the same level.
Any suggestions!
thanks for your help


08-05-2002, 04:22 PM
Not exactly...an initial slash, such as you have in your example, will more often than not indicate that this is in reference to the root directory, so that /cgi-bin/ will always point to the correct path no matter where in the directory you are. This is Virtual Directories.

Now, if you just had cgi-bin/whatever.pl, your assumption would be correct. Almost exclusively, servers have cgi-bin set up as a virtual directory so that that initial slash method works even if virtual directories are not enabled.

And, you can always use the full path to your script (yourname.com/etc.), though it may prove annoying for you tending on how many domains you have and what kind of globalization scripts you may be using...

08-05-2002, 05:54 PM
thanks for your answer, but....
I tried that : <a href=cgi-bin/Hello.cgi>Hello.cgi</a>
and did get a 404, which -forgive me, I'm not familiar with virtual directories- makes sense since the cgi-bin directory is one level "above" the directory (entitled "documents") that holds the index.

I assume that from the title of the documents, you'll understand that I am making real easy on myself !
I've been waiting for a clear answer from my host (pointhost), but could'nt get anything more than "you got perl installed".
May be I could move the cgi-bin directory down to the level of the index ?
thanks for your help!

Stephane (hi from rainy Paris!)

08-05-2002, 08:57 PM
As I previously indicated, using /cgi-bin/ as an href or form action is the most common application, though some servers can have customization that alters or negates that practice. You should not be trying to use cgi-bin/.

If you are using the initial slash (/cgi-bin) then it does not matter what page is calling the link, get it? root/dir/file.php linking to /cgi-bin/ is always going to be equivalent to root/cgi-bin/, no matter what cwd you are currently in.

A lot of people seem to have a problem grasping virtual directory linking, but it is quite simple...

You should be using <a href=/cgi-bin/Hello.cgi>Hello.cgi</a>, and if that does not work, your host has some non-standard configurations and your only work-around may be to use a full url path to your bin.

08-09-2002, 08:28 PM
If your cgi-bin directory above the page you're calling it from try <a href="../cgi-bin/whatever.cgi">whatever</a> .. is the directory above you so it should work, unless you've got some weird stuff set up on your server...