![]() |
Location Header CGI![]() ![]() ![]() ![]() ![]()
Your CGI programs can deliver an existing file from your file system or from another Web server by using the Location header. To use it, you specify either a file location relative to the root of your Web directory tree or a URL. Location : absoluteURL For example, suppose you want the CGI program to return the hello.html document. #!/usr/local/bin/perl print "Location: /hello.html\n\n"; When the browser requests one of these index.cgi programs, the server will return the same headers and the body as it does when the browser requets the hello.html file directly, something that looks like the following: Note that the Location header is nowhere in sight. When the CG I program sends a Location header followed by a file location, the server retrieves and returns ' file as if that were the original request from the start. You could simply have your CGI program output this message using several print messages. However because the message is static, you could also save this message in an HTML and call it from your CGI program using the Location header. This way, if,, want to modify the message in any way, you edit the HTML file rather than CGI code. You can redirect a Web browser to another Web site using a Location header followed by a URL. Other useful HTTP status codes to know for CGI programming are listed below in the table. In order to set the status code of the server responsible from your CGI program, use the Status header followed by the status code an optional status message. For example, to send a status code of 204, print the following line:
Status : 204 No Content
|
|
CGI
Advantages of CGI
How CGI Works
Compiled Versus Interpreted
Input to CGI
CGI Introduction Program
HTML Forms
Accepting Input from the Browser
CGI Environment Variables
Get Versus Post Method
Get Method
Post Method
Sample <FORM> Based CGI Program
Complete Example for <FORM>
Output from CGI
Header and Body:Anatomy of Server Response
HTTP Headers
Carriage Returns and Newlines
Formatting Output CGI Common MIME TypesLocation Header Useful HTTP Stautus Codes Other Headers Dynamic Pages Sending Images Displaying the Current Date Feedback Form Program Server Side Includes Server Side Include Environment Variables Displaying the Date with Date Counter Example of SSI Counting the Number of Accesses Better Approach Towards CGI Program Client Versus Server Accessing a HTML Document Submitting a Form Accessing a CGI Program Databases ODBC Creating a DSN Win32::ODBC Module Creating a Table Inserting Data into a Table Deleting Data from a Table
Updating Data in a Table
Selecting Data from a Table Operating Systems Security Securing Your Web Server Writing Secure CGI ProgramWeb DesignDomain Names Home
FAQ
My Account
IP Address
SSL Certificates DNSWeb Hosting Web Server Cheap Web Design Dedicated web hosting Managed web hostingE Commerce Principles of E-Commerce E-Banking Electronic Payment System E-Security Credit Cards Smart Cards
The Mailbox POP Server SMTP Server IMAP Protocol |
| Home | Web Hosting | Web Design | Sitemap |
| Copyright (C) 2007. Web Domain design hosting. All rights reserved. |