how to redirect to a web-page by shell script

Dear all,
I am calling a korn shell script(CGI script) by a web-page. This shell script do some checking in a unix file and return true or false. Now within the same script, If it returns true then I want to redirect to another web-page stored in htdocs directory.
Example: Login page sends a username and password which is authenticated by a shell script. If the authentication is successful the shell script redirect to a next page which is stored in htdocs directory of apache web-server.
Thanks.

Send either an HTTP code 301 or 302. Or send an HTML page containing

<meta http-equiv="refresh" content="0; url=http://www.yourdomain.com/whatever.ext"/>

somewhere in the <head>er. Or open the file yourself and just stream it through.

Dear Pludi,
In this case the web-page which I am calling through the script can be open directly if someone knows the name of the web-page.
The web-page is in htdocs directory, if there is a method so that I can block the page to be opened directly by writing in url and can be opened only when I call it through script. It will solve my problem.
Thanks

You'll probably have to

  • write a wrapper script that checks the authorization and only then serves the page OR
  • have your script set a cookie that an embedded JavaScript reads and then hides/unhides the content

By the way, most of the functionality you've asked for so far could be done using HTTP Basic authentication (plus a script if the user wants to change his/her password)