Solved

cgi command to call webpage on apache linux server

Posted on 2006-10-27
8
184 Views
Last Modified: 2013-12-25
Currently I have a cgi file (lets call it app.cgi) on my website that runs an application.  The contents of the app.cgi file look something like this:

PGM=../path/to/app/appname;export PGM

Well the appname is currently under construction and I have a lot of pages that still point to this app.cgi file. I want this cgi file to call up a webpage instead which I have created that tells my users that the page is under contrction. This webpage is called construction.html.

What do I do to my cgi file (app.cgi) so that construction.html is called instead of the PGM?

Thanks!
0
Comment
Question by:bfilipek
  • 5
  • 3
8 Comments
 

Author Comment

by:bfilipek
Comment Utility
This might help more:

The entire contents of the currenty cgi file looks like this (between the = signs):
=========================
#!/bin/bash

PGM=../path/to/app/appname;export PGM
MEM=4096;export MEM
/bin/sh ./bwu.sh
=========================
0
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
Comment Utility
#!/bin/bash
cat <<EOF
Status: 302 Moved
Location: http://www.yoursite.com/construction.html

EOF

0
 

Author Comment

by:bfilipek
Comment Utility
Perfect. Thank you.
0
 

Author Comment

by:bfilipek
Comment Utility
One more question. I see you have the absolute path to the page. Is there a way I can use a relative path? For example:

Location: ../html/construction.html

I tried the above and couldnt get it to work. Thanks again.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 48

Expert Comment

by:Tintin
Comment Utility
HTTP redirects need to be an absolute URL.

Why do you want to use a relative path?
0
 

Author Comment

by:bfilipek
Comment Utility
We have two websites that are clones of each other (one used for testing, one use for production). One is located at /var/www/testweb and one is at /var/www/prodweb. If I have an absolute path, I have to modify this CGI file each time I do a copy of the test site to the live one if changes are made. The relative path would prevent this.

Any ideas? If not I can just stick with your original suggestion. Thanks again.
0
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
To make it work for any site, do

#!/bin/bash
cat <<EOF
Status: 302 Moved
Location: http://$HTTP_HOST/construction.html

EOF
0
 

Author Comment

by:bfilipek
Comment Utility
That worked, thank you very much Tintin.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now