Re: CGI PATH_TRANSLATED variable?

Not quite.  If you have the serverroot at
  /var/web
and you have /htdocs and /cgi-bin  in the serverroot dir, and you have
two documents in /htdocs called  
  /foo.html and /baz/bar.html
then a request for /var/web/htdocs/foo.html looks like this
   http://yourserver/foo.html
and baz/bar.html is
   http://yourserver/baz/bar.html

Running through a gateway at
   http://yourserver/cgi-bin/script
the request using PATHINFO .html would be
   http://yourserver/cgi-bin/script/foo.html
      PATH_INFO= /foo.html
      PATH_TRANSLATED= /var/web/htdocs/foo.html

while
   http://yourserver/cgi-bin/script/baz/bar.html
      PATH_INFO= /baz/bar.html
      PATH_TRANSLATED= /var/web/htdocs/baz/bar.html

The advantage is that the server will do user-dir escaping for you, so
   http://yourserver/cgi-bin/script/~baz/bar.html
      PATH_INFO= /~baz/bar.html
      PATH_TRANSLATED= /u/baz/public_html/bar.html

This makes it easy to open the files and process them in the script.
Check  http://www-pcd.stanford.edu/mogens/script.html  for an example
of path_info use.

Christian

Received on Wednesday, 22 March 1995 22:43:41 UTC