Thanks to the URL, the HTTP server knows if the navigator requests a document or
a script execution. In fact, CGI scripts have specific extensions like .PL,
.SH, .CGI . So the server can easily recognize them. Moreover sometimes, URL
contains special directories like cgi-bin. They indicate the resource which
is requested.
Example :
http://www.lecours.com/cgi-bin/what_news.cgi?
When the server see the cgi-bin directory, it searches in the httpd.conf if
this directory is associated with a special module. If it is the case, the http server
gives control to this special module which will execute the resource.
Note :
CGI has evolved with the time : a lot of programmes written in JAVA (servlets),
... exchange parameters with http server thanks to the CGI environment variables.