httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: [users@httpd] Custom Error Handling
Date Tue, 16 Jun 2009 10:49:35 GMT
Alan Wilson wrote:
> Thanks - that makes sense, using a test along the lines of
> 
> print "Content-Type: text/html\n";
> print "Status: 302 Moved\nLocation: http://www.mydomain.com/test.cgi\n\n";
> print "\n"; 
> 
> Seems to do what I want.
> 
That is strange, and I am surprised it works (but I don't know everything).
The way you are doing it above, you are still sending an (implicit) HTTP 
response code of 200 (OK), and then sending a HTTP header "Status:", 
which is normally not how these things work.


Assuming you are not using CGI.pm, I would have written it as :

print "302 Moved\n";
print "Location: http://www.mydomain.com/test.cgi\n\n";


In perl, and using the CGI module, you would have something like :

...
use CGI qw/:standard/;
...
my $q = new CGI;
...
print $q->redirect(-uri=>'http://somewhere.else/in/movie/land',
                -status=>302);
exit 1;

See http://cpan.uwinnipeg.ca/htdocs/CGI.pm/CGI.html




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message