Solved

cgi command to call webpage on apache linux server

Posted on 2006-10-27
8
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

 

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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

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…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to count occurrences of each item in an array.

710 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