119 121




Apache Server for Windows Little Black Book:Extending Apache's Power With Modules
function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) { var end = document.cookie.indexOf (";", j); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(j, end)); } i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } var m1=''; var gifstr=GetCookie("UsrType"); if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; } document.write(m1+m2+m3);            Keyword Title Author ISBN Publisher Imprint Brief Full  Advanced      Search  Search Tips Please Select ----------- Components Content Mgt Certification Databases Enterprise Mgt Fun/Games Groupware Hardware IBM Redbooks Intranet Dev Middleware Multimedia Networks OS Prod Apps Programming Security UI Web Services Webmaster Y2K ----------- New Titles ----------- Free Archive To access the contents, click the chapter and section titles. Apache Server for Windows Little Black Book (Publisher: The Coriolis Group) Author(s): Greg Holden with Matthew Keller ISBN: 1576103919 Publication Date: 01/01/99 function isIE4() { return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') ); } function bookMarkit() { var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0"; parent.location.href=url; //var win = window.open(url,"myitk"); //if(!isIE4()) // win.focus(); } Search this book:  















Previous
Table of Contents
Next




Serving A File Without HTTP Headers
Usually, when a server sends a file to a Web browser, it sends some basic information about the file, as in this example of the header that accompanied a response from the Apache Group Web site (www.apache.org):


HTTP/1.1 200 OK
Date: Tue, 22 Sep 1998 23:53:49 GMT
Server: Apache/1.3.3-dev (Unix)
Cache-Control: max-age=86400
Expires: wed, 23 Sep 1998 23:53:49 GMT
Connection: close
Content-Type: text/html


In certain circumstances, you may choose to use the mod_asis module to send a document without any header information. Such a document is called an .asis file, and has the file-name extension .asis.


TIP:  You can view the headers sent by Web servers at a page provided by Pascal Geinger (echo.znet.de/cgi-bin/get). Enter the URL of the server you want to access, click on Start, and in a matter of seconds, the header is displayed on a new Web page.

You might create an .asis file to send information that redirects the browser to another location. The following steps describe how to create an .asis redirection file:


1.  Open srm.conf in Notepad.
2.  Uncomment the AddType directive and change the existing text or enter a new AddType directive:


AddType httpd/send-as-is asis


This maps the file-name extension .asis to the MIME type httpd/send-as-is.
3.  Choose File|Save to save the changes to srm.conf.
4.  Choose File|New to open a new blank document.
5.  If you send an .asis file without any headers, you have to add the header information to the document itself. The Status header is required, followed by a three-digit HTTP response code and a textual message. You should probably add the Last-Modified header as well because it is not automatically added by Apache. You might enter the following:


Status: 301 Note Our New Location
Location: http://www.newaddress.com/
Last-Modified: [today's date]
Content-Type: text/html

<HTML><HEAD>
<TITLE>Move With Us</TITLE>
</HEAD><BODY>
<H1>We've Moved!</H1>
Please update your browser favorites to point to <A
HREF="http://www.newaddress.com/">our new Web site </A><P>
</BODY></HTML>


6.  Choose File|Save. Save the file with the name redirect.asis and place the document in your ServerRoot.

When a Web browser requests this file, the 301 status message tells the browser to redirect the request. Although the Status header is needed, you do not have to add a Date header and Server header because Apache adds them automatically.

Manipulating HTTP Headers
If you ever want to add information to the HTTP response header that Apache sends to a client, you can use the Header directive, which is provided by the mod_headers module. Header takes this syntax:


Header Action Value


It also contains the following:


•  Context—server config, virtual host, directory, per-directory (.htaccess)
•  Status—optional

To use mod_headers, follow these steps:


1.  Open httpd.conf in Notepad and uncomment the following line:


#LoadModule headers_module modules/ApacheModuleHeaders.dll


2.  Add the Header directive to one of the configuration files along with one of its four possible actions:

•  Set—Lets you set a header. The names of any previous headers are set to this one.
•  Add—Lets you add a new header in addition to any you already have (you can conceivably have more than one header with the same name).
•  Append—Lets you add the value to an existing header value.
•  Unset—Lets you remove a header.

3.  To change the “Server: Apache 1.3.3” header to “Server: Apache 1.3.3 for Windows”, specify the following:


Header Append Server "for Windows"


4.  If, additionally, you want to add a new header, specify the following:


Header Add Author "Greg Holden"


This would add a new header, Author, with the value “Greg Holden”.
5.  To remove an existing header, specify:


Header Unset Author



The HTML tag <META>, when used with HTTP-EQUIV, also lets you add additional items to HTTP response headers.



Previous
Table of Contents
Next






Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.



Wyszukiwarka

Podobne podstrony:
121 atyt
119 be bytopic stockmarket2
casio edifice efa 1190
119 Wielkosci opisujace dawki promieniowania jonizujacego Grey REM
1213@7 pol ed02 2005
118 119
115 119 xi22kpe4v6aw2usv563v6aqbqkwbv32zcvqol5y

więcej podobnych podstron