Solved

cgi command to call webpage on apache linux server

Posted on 2006-10-27
8
190 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
DevOps Toolchain Recommendations

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

 

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
 
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

DevOps Toolchain Recommendations

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need help editing script 3 72
Recursive folder search vbscript 7 47
running netsh advfirewall set rule on multiple computers 3 46
Control Number of Log Files -Perl 7 71
This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

775 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