Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with a Perl URL Redirect 1

Status
Not open for further replies.

marms767

ISP
Joined
May 17, 2001
Messages
3
Location
US
I'm a ColdFusion developer with no Perl experince and our Perl guy just quit. I need to redirect all the traffic from his /cgi-bin/signup_form.cgi to my /signup_form.cfm which does the same thing. I have been attempting to replace his file with code like "the bouncer" and other similar URL redirect scripts, but when I try it, it gives me a "Internal Server Error" saying "The server encountered an internal error or misconfiguration and was unable to complete your request."

I also have to pass a parameter through the URL called NPONum to the CFM page.


needs to be redirected to


Please Help.

Thanks
 
How is the NPONum assigned? Is it a system generated number when the user clicks on the link to the signup form or is it a hard-coded number?

If it's the earlier, you'll probably have to do some coding to grab that parameter and feed it into a redirect. This could be as simple as a HTML Meta redirect, but due to the extra parameter needed, it'll have to be snatched up on the load of the page and placed into the redirect statement.

If you'd like help with this, feel free to e-mail me at walterg2@nationwide.com and let me know how it all works.
 
Since you don't need to decode the parameters, just get them and pass them on again, the simple redirect program below should do the trick. Insert your domain name into the last print statement (it has to be a full URL). Replace the existing signup_form.cgi with this script.
Code:
#!/usr/local/bin/perl

# Get the form data
if ( $ENV{"REQUEST_METHOD"} eq "GET" ) {
	$FormData = $ENV{"QUERY_STRING"};
} elsif ( $ENV{"REQUEST_METHOD"} eq "POST" ) {
	read(STDIN, $FormData, $ENV{"CONTENT_LENGTH"});
} else {
	print "Content-type: text/html\n\n";
	print qq[<html><head></head><body><h2>Invalid Form Method: $ENV{&quot;REQUEST_METHOD&quot;}</h2></body></html>];
}

# Redirect

print &quot;Location: [URL unfurl="true"]http://www.yourdomain.com/cgi-bin/signup_form.cfm?$FormData\n\n&quot;;[/URL]

exit 0;
1;
Let me know how it works.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top