Altera_Forum
Honored Contributor
21 years agoCGI problem
Hello:
I am testing a CGI program using C language and Shell under the Nios2 Linux system. What I want is to implement the "Redirection" function to redirect user's browser to a website: for exmaple "www.google.com". My approach is to print the "Location: URL" header to user's browser. What I did is like this, I wrote a C program that is doing simple I/O access,and contains the last line: printf("Location: http://www.google.com\n\n"); (http://www.google.com\n\n"%3b%29;) I also wrote a shell scirpt which was: # !/bin/sh echo "Location: http://www.google.com" (http://www.google.com") echo "" Finally,I put them into the proper place and tried to link them using IE. Both execution turned out successful(I/O result was correct),but they did't bring me to google! After the execution,both of them only took me to the previous folder. (i.e. from http://192.168.1.1/cgi-bin/test.cgi (http://192.168.1.1/cgi-bin/test.cgi) to http://192.168.1.1/cgi-bin/ (http://192.168.1.1/cgi-bin/) ) Can anyone please tell me what's the problem!? Thank you so much. Best Regards.