homepage Welcome to WebmasterWorld Guest from 54.166.173.147
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
Perl-Cgi redirection using Apache webserver
gsarin




msg:3913327
 8:46 am on May 14, 2009 (gmt 0)
Hi,

I am stuck into a small issue. I am just simply trying to redirect to a different page if the batch file runs successfully thru system command. success_Calc.html is stored in cgi-bin folder and htdocs folder of the apache server. I have searched the net and tried the below commands but redirection ceases to work. It just prints the URL on the web browser. Are there any config file setting required for this on Apache server?

my $res=system ("test.bat");
if ($res==0){
$cgi-> redirect('http://servername:port/cgi-bin/calc_success.html';}

#{print 'Status: 302 Moved', "\r\n", 'Location: http://servername:port/htdocs/calc_success.html', "\r\n\r\n";}

#{print "Location: http://servername:port/htdocs/calc_success.html$ENV{'REQUEST_URI'}";}

#{ print redirect(-uri=>'http://servername:port/calc_success.html',
# -nph=>1,
# -status=>301);}

I have also tried calc_success.pl which is again a perl file with some HTML tags in it.

the URL is accesible with the browser and there are no errors in Apache error log.

Any pointers will be appreciated

Thanks in Advance!

 

krugs




msg:3913357
 9:40 am on May 14, 2009 (gmt 0)

the cgi-bin is generally setup to not respond to requests for stuff like html pages, so that is probably the problem there. If the html document is in the htdocs folder you don't include that in the URL, its just the www root folder generally so you just use the doamin name and the file name:

$cgi-> redirect('http://servername/calc_success.html');

assumes you have loaded the CGI module and created the $cgi object.

Note the syntax errors in your posted code.

phranque




msg:3914110
 4:10 am on May 15, 2009 (gmt 0)

welcome to WebmasterWorld [webmasterworld.com], gsarin!

you are probably going to have to name it as a .cgi file and/or configure apache to activate cgi scripts with that file extension using AddHandler Directive [httpd.apache.org].

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved