PDA

View Full Version : pfff redirect


cooldaddy
09-08-2006, 12:04 PM
Hi im trying to build in a simple redirect into my site. When a user clicks an image with href="http://www.msnemo.com/cgi-bin/language.cgi?german" it should execute the cgi script and redirect.. However I get an error screen with the message: "the page cannot be shown". I used w3.org's html validator on "http://www.msnemo.com/cgi-bin/language.cgi?german" to see what it would say... it said : 500 Access to 'location' URIs has been disabled

I really haven't got a clue what's wrong...


#!/usr/bin/perl
use CGI;
@ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'});
if ($ARGV[0] eq "german"){
$baseurl="Location: http://66.249.93.104/translate_c?hl=en&ie=UTF-8&oe=UTF-8&langpair=en%7Cde&u=http://www.msnemo.com/&prev=/language_tools\n\n";
}
print "Location: $baseurl\n\n";

FishMonger
09-08-2006, 04:28 PM
#!/usr/bin/perl

use CGI qw(:standard);

if (param('keywords') eq 'german') {
print redirect('http://66.249.93.104/translate_c?hl=en&ie=UTF-8&oe=UTF-8&langpair=en%7Cde&u=http://www.msnemo.com/&prev=/language_tools');
}

FishMonger
09-08-2006, 04:32 PM
It might be better to change your hyperlink to use a named param.

href="http://www.msnemo.com/cgi-bin/language.cgi?lang=german"

Then the if conditional in the script would be adjusted to:

if (param('lang') eq 'german') {

cooldaddy
09-08-2006, 05:27 PM
Thanks fishmonger..problem is solved :)