Solved

cgi command to call webpage on apache linux server

Posted on 2006-10-27
8
187 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
ID: 17819252
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
ID: 17830046
#!/bin/bash
cat <<EOF
Status: 302 Moved
Location: http://www.yoursite.com/construction.html

EOF

0
 

Author Comment

by:bfilipek
ID: 17833901
Perfect. Thank you.
0
 

Author Comment

by:bfilipek
ID: 17833928
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 48

Expert Comment

by:Tintin
ID: 17837211
HTTP redirects need to be an absolute URL.

Why do you want to use a relative path?
0
 

Author Comment

by:bfilipek
ID: 17838115
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
ID: 17838662
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
ID: 17842195
That worked, thank you very much Tintin.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Do you have experts in the field of AutoIt coding? 25 116
Sed question 2 69
Disk Ram Peak 1 33
copy-item script help 15 68
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 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

14 Experts available now in Live!

Get 1:1 Help Now