Apache Server for Windows Little Black Book:Organizing Your Web Site
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
Configuring Directory Options
Once your directory tree is structured the way you want, you can use the Options directive to activate special options that are commonly used for primary and virtual host configuration.
For instance, follow these steps to enable indexing and server-side includes in the htdocs directory:
1. Open a configuration file, such as access.conf, in Notepad.
2. If you are working with access.conf, uncomment the lines that cover the Options directive (near the beginning):
#<Directory />
#Options FollowSymLinks
#AllowOverride None
#</Directory>
Change them to the following (substitute your own directory path for the one shown):
<Directory C:/Apache/www/local/public/htdocs>
Options Indexes Includes
</Directory>
3. Choose File|Save to save your changes.
The Options directive can be used in many contexts: server config, virtual host, per-directory, and .htaccess files. It has the following syntax:
Options [+|-] option [+|-] option ...
In addition, the following applies:
Contextserver config, virtual host, directory, .htaccess
The following options can be used as arguments to Options:
NoneDisables all options in the chosen scope (virtual host, directory, and so on).
AllEnables all options except MultiViews in the chosen scope.
ExecCGIEnables execution of CGI scripts in the chosen context.
FollowSymLinksTells Apache to follow symbolic links in the directory. Symbolic links are short files that point to other directories or files under Unix. Hence, its not applicable to Apache for Windows.
IncludesAllows server-side includes in the chosen context.
IncludesNOEXECPermits server-side includes but disables the #exec and #include SSI commands.
IndexesTells the server to present a formatted directory list to the client. The list appears if a client sends a URL that maps a request to a particular directory and there is no DirectoryIndex such as index.html present.
SymLinksIfOwnerMatchThis is another Unix-specific option that doesnt apply to Windows.
MultiViewsTells Apache to deliver content that is negotiated based on a documents language.
The plus sign (+) is only needed if you want to activate an option that was disabled in an earlier directive. If youre using Options only once, you dont need to include + to enable an option. The minus sign (-) disables an option.
Creating Personal Web Directories
Sites that have many different users often need to provide those users with directory space where they can locate their individual HTML files and Web documents. Many sites use the following URL convention to allocate space to users:
http://www.hostcompany.com/~user/
In this sort of configuration, ~user is actually an alias for a document root directory in the users home directory. All users need to have a DocumentRoot that will hold their individual Web sites. In an organization that has a large number of users (such as an ISP), it helps to have a shortcut that maps to users individual Web-site directories. In Apache, the shortcut is UserDir. The default setting is as follows:
UserDir public_html
Consider, for instance, two users named John and Mary. Their Web site directory structures would look like something like this:
C:/Apache/www/home/john/public_html
C:/Apache/www/home/mary/public_html
With UserDir set to public_html, a visitor would only have to enter the following to access Johns or Marys Web-site files:
http://www.hostcompany.com/~john/index.html
http://www.hostcompany.com/~mary/index.html
Each request maps to the following:
C:/Apache/www/home/john/public_html/index.html
C:/Apache/www/home/mary/public_html/index.html
You dont have to use the default of public_html. You can simply change the directory to html or whatever name you like by setting the name as an attribute to UserDir.
Setting The Default Type For A Directory
In the course of assembling a Web site, you may want to make available a group of files that are all of the same type, even though they may not all have file-name extensions that make their nature obvious. For instance, your text files could be named file1, file2, and so on rather than file1.txt, file2.txt, and so on.
You can use the DefaultType directive to configure Apache to identify the default file type for the directory. This saves your visitors from having to see a browser alert that asks them what to do with such a file.
Apache use the DefaultType directive to identify a file whose MIME type cannot be determined from its existing list of MIME types.
To set the default type for a directory that contains only plain-text files, follow these steps:
1. Open access.conf in Notepad.
2. Enter the following (substitute the directory path shown with your own path):
<Directory C:/Apache/htdocs/textfiles>
DefaultType plain/text
</Directory>
3. Additionally, you can specify DefaultType with a virtual host, an .htaccess file, or on a server-wide basis. The syntax is as follows:
DefaultType mime-type
In addition, the following apply:
DefaultDefaultType text/html
ContextServer config, virtual host, directory, .htaccess
OverrideFileInfo
4. Choose File|Save to save your changes and restart Apache so the changes take effect.
If you use the plain/text designation instead of an alert dialog box to ask the user how to act on a file, the browser receives a header identifying the file as plain text and displays the text immediately.
MIME-type information is configured with the directives supplied by the mod_mime module, which is compiled into Apache by default. The AddType directive, for instance, is used to match a new MIME type with a list of file-name extensions. See Chapter 6 for more information on mod_mime and its directives.
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