-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday 29 September 2002 14:10, Karolina Lindqvist wrote:
> That sounds like a much better way of doing that what I am doing. Should I > just send that stuff back? Basically, yes. > This is my small cgi script with the name "debian": > > #! /usr/local/bin/python > > import os, string, ip > > print "Content-type: text/html" > print > > QUERY_STRING = os.environ["QUERY_STRING"] > PATH_INFO = os.environ["PATH_INFO"] > request_uri = os.environ["REQUEST_URI"] > > where = string.index(request_uri, "htbin/cgiwrap/pgd/") > newurl = "http://" + ip.ip + request_uri[where+17:] > > print "<html><head>" > print '<meta http-equiv="refresh" content="0; url=', newurl, '">' > print "</html>" > > The file ip.py just contains whatever is my current ip at the moment: > ip="217.208.212.10" I don't know python, but the following should be what you want: #! /usr/local/bin/python import os, string, ip QUERY_STRING = os.environ["QUERY_STRING"] PATH_INFO = os.environ["PATH_INFO"] request_uri = os.environ["REQUEST_URI"] where = string.index(request_uri, "htbin/cgiwrap/pgd/") newuri = "http://" + ip.ip + request_uri[where+17:] print 'HTTP/`1.0 302 Found' print 'Location: ', newuri' print Please exuse any errors in the code/syntax - I don't know python. Also, you will need to configure your webserver so that it does not create it's own HTTP header for this cgi program. Search the config file for nph, non-parsed-head, parse or similar and check the documentation. Basically, if your webserver manages to run the program okay, it will put a HTTP header on the output, but you want your program to give the HTTP header, not your server. Again, let us know what server you are running (and maybe post an except from it's config) and someone will try and help, I'm sure. Paul Cupis - -- [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9lv+aIzuKV+SHX/kRArcWAJ40zPsamn73gJngjP1KDtqKBWACxwCfeAKn b8/ypeUWWWAgXddKUjYmP7I= =s2hw -----END PGP SIGNATURE-----