ACCC Home Page ACADEMIC COMPUTING and COMMUNICATIONS CENTER
Accounts / Passwords Email Labs / Classrooms Telecom Network Security Software Computing and Network Services Education / Teaching Getting Help
 

Redirecting Web Pages

   
 
     
ASIS files
 

When HTML files are sent to a browser, the web server adds appropriate HTTP headers. But on tigger and icarus, if the web file ends with the extension asis, is assumed to contain all HTTP headers as well as any appropriate HTML. In this case, the file is sent as is, with no modifications. The most common use for this feature is to send the Location HTTP header, which will redirect the client to some other URL.

Note that if you have been using index.html files with default urls, you can simply substitute index.asis with no change in the url.

Here's an example asis file:

Status: 302 Relocate status
Location: http://www.new.place.com/new/
Content-type: text/html

<HTML>
<HEAD>
<TITLE>New Home Page</TITLE>
</HEAD>
<BODY>
<H1>We've Moved</h1>
<A HREF="http://www.new.place.com/new/">New Page</A>.
</BODY>
</HTML>
Notes:
  • You must include all relevant HTTP header lines. In particular, you need the Status: 302 and the Location: http://new.url/... headers.
  • The Content-type: header and the other HTML are not really necessary. They are useful only for browsers that don't support the Location directive. If you do want to include this, be sure to leave a blank line between the Location header and the HTML.
 
     
Form Submission / CGI script
 

In this case, you'd like the user to submit a form, and the result of the submission will be to redirect the user to a new URL. This is useful if you have a long list of links that you'd prefer to put in a select box.

Suppose you have a page like this:


<a href="http://www.uic.edu/page1/">Goto page1</a>
<a href="http://www.uic.edu/page2/">Goto page2</a>
<a href="http://www.uic.edu/page3/">Goto page3</a>
<a href="http://www.uic.edu/page4/">Goto page4</a>
<a href="http://www.uic.edu/page5/">Goto page5</a>
<a href="http://www.uic.edu/page6/">Goto page6</a>

If the list is really long, you can substitute the following construct:

 <form method=get action="http://www.uic.edu/htbin/location.pl">
    Select new page:<br>
    <select name=location size=3 >
	<option value="http://www.uic.edu/page1/">Page 1
	<option value="http://www.uic.edu/page2/">Page 2
	<option value="http://www.uic.edu/page3/">Page 3
	<option value="http://www.uic.edu/page4/">Page 4
	<option value="http://www.uic.edu/page5/">Page 5
	<option value="http://www.uic.edu/page6/">Page 6
    </select>
    <input type="submit" value="Go to Selection">
 </form>

The use of this ought to be clear from the above example, if you know about HTML forms. Just make sure that:

  • The value of action in the form tag is as show above.
  • The name of the select tag is location, as shown above.
 


2005-8-16  wwwtech@uic.edu
UIC Home Page Search UIC Pages Contact UIC