CSCI E‐12 Fundamentals of Website Development Table of Contents | All‐in‐One | Link List | Examples | Lecture Notes Home | CSCI E‐12 Home A form for lecture feedback is available from the course web site. Please take two minutes to fill it out aſter you have seen the lecture. April 14, 2010 Harvard University Extension School Course Web Site: hp://cscie12.dce.harvard.edu/ Instructor email: [email protected]Course staff email: [email protected]Image created at wordle.net CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html 1 of 77 4/14/2010 4:57 PM
77
Embed
One | Link List | Examples | Lecture Notes Home | CSCI E ...cscie12.dce.harvard.edu/lecture_notes/2010/20100414-1.pdfTLDs are managed by the Internet Assigned Numbers Authority (IANA)
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CSCI E‐12 Fundamentals ofWebsite Development
Table of Contents | All‐in‐One | Link List | Examples | Lecture Notes Home | CSCI E‐12 Home
A form for lecture feedback is available from the course web site. Please take two minutes to fill it out after you haveseen the lecture.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
3 of 77 4/14/2010 4:57 PM
TCP/IP: Transmission Control Protocol/Internet Protocol
IP Addresses and Hostnames
E.g. the name cscie12.dce.harvard.edu resolves to the IP address of 140.247.197.241.
DNS: Domain Name System
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
4 of 77 4/14/2010 4:57 PM
Hosts. Over 732 million Internet hosts as of January 2010, ISC Internet Domain Survey
Web Sites. Over 206 million Web sites in March 2010, Netcraft Web Server Survey.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
5 of 77 4/14/2010 4:57 PM
Name ("A" record): morpheus.dce.harvard.edu
IP Address: 140.247.197.241
Aliases (CNAME):
cscie12.dce.harvard.edu
cscie153.dce.harvard.edu
cscis12.dce.harvard.edu
Domain Name System (DNS)
A hierarchical, distributed naming system.
Resolving: cscie12.dce.harvard.edu
Request from User Machine to User's Primary DNS Server1.Request from User's Primary DNS to Root Server2.Request to Root Server for ".edu" namespace (or .com, .gov, .net, .uk, .jp, etc.)3.Request to Primary "harvard.edu" DNS Server4.Request to Primary "dce.harvard.edu" DNS Server5.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
6 of 77 4/14/2010 4:57 PM
TLDs are managed by the Internet Assigned Numbers Authority (IANA) A sample listing is below:
.com
.org
.edu
.gov
.mil
.net
2‐Letter Country Codes
.us
.de
.uk
complete list
More Top Level Domains.
.aero
.biz
.coop
.info
.museum
.name
.pro
List of all Generic Top Level Domains
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
7 of 77 4/14/2010 4:57 PM
Domain Name
Buy the domain through a "registrar"
Provide name servers
About $10/yr
1.
Hosting
Shared ($7‐15/mo)
Private
Virtual Private
2.
A very short list of hosting companies that I've done business with.
DreamHost
Go Daddy
Web.com
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
8 of 77 4/14/2010 4:57 PM
Domain Name: HARVARD.EDU
Registrant: Harvard University Network Operations Center 60 Oxford Street Cambridge, MA 02138 UNITED STATES
Administrative Contact: Jay Tumas Network Operations Manager Harvard University Network Operations Center 60 Oxford Street Cambridge, MA 02138 UNITED STATES (617) 496-8500 [email protected]
Technical Contact: Jay Tumas Network Operations Manager Harvard University Network Operations Center 60 Oxford Street Cambridge, MA 02138 UNITED STATES (617) 496-8500 [email protected]
Name Servers: EXTERNALDNS-C1.HARVARD.EDU 128.103.200.35 EXTERNALDNS-C2.HARVARD.EDU 128.103.200.51
Domain record activated: 27-Jun-1985Domain record last updated: 06-Apr-2010Domain expires: 31-Jul-2010
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
9 of 77 4/14/2010 4:57 PM
client‐server computingThe interaction between two programs when they communicate across a network. A program at one site sends a requestto a program at another site and awaits a response. The requesting program is called a client; the program satisfying therequest is called the server. (definition from The Internet Book, 2nd edition by Douglas E. Comer)
Application Layer of Network
HTTP (default port 80)
FTP (port 21)
SMTP (port 25)
POP
IMAP
telnet (port 23)
ssh (port 22)
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
10 of 77 4/14/2010 4:57 PM
Specifies the grammar of a conversation between an HTTP‐client (Web Browser) and an HTTP‐server (Web Server) is totake place.
view plain print ?
$ telnet www.npr.org 80 1.Trying 216.35.221.84... 2.Connected to www.npr.org. 3.Escape character is '^]'. 4.GET / HTTP/1.1 5.Host: www.npr.org 6. 7.HTTP/1.1 200 OK 8.Date: Tue, 21 Jul 2009 18:14:39 GMT 9.Server: Apache/2.2.4 (Unix) 10.Set-Cookie: v1st=E7C603597016F190; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT; domain=.n11.Set-Cookie: v1st=E7C603597016F190; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT; domain=.n12.Last-Modified: Tue, 21 Jul 2009 18:09:41 GMT 13.ETag: "11672-288e2340" 14.Accept-Ranges: bytes 15.Content-Length: 71282 16.Cache-Control: max-age=300 17.Expires: Tue, 21 Jul 2009 18:19:39 GMT 18.Vary: Accept-Encoding 19.Content-Type: text/html 20. 21.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 22. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 23.<html xmlns="http://www.w3.org/1999/xhtml"> 24. <head> 25. <title>NPR : National Public Radio : News & Analysis, World, US, Music & Art26. <style type="text/css" media="screen">@import "/templates/css/mainstyles.css";</style> 27. <style type="text/css" media="screen">@import "/templates/css/hp.css";</style> 28. <link rel="stylesheet" type="text/css" media="print" href="/templates/css/print_hp.css" />
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
11 of 77 4/14/2010 4:57 PM
HTTP is Stateless
Each requested resource is a separate, independent, request to the server ‐‐ it is a stateless protocol.
HTTP Versions
W3C and Internet Engineering Task Force (IETF) oversees the Hypertext Transfer Protocol.
HTTP 1.0 (1996)
HTTP 1.1 (1999)
Extensions to HTTP
WebDAV
An HTTP Conversation
Client Request
METHOD Resource HTTP Version
Client Generated Headers
Request Body
Server Response
Status Line
Server Generated Headers
Data
HTTP 1.1 Methods
GET
POST
HEAD
PUT
DELETE
TRACE
OPTIONS
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
12 of 77 4/14/2010 4:57 PM
HTTP 1.1 status codes commonly seen
200 OK
301 Moved permanently
302 Moved temporarily
304 Not modified
401 Unauthorized
403 Forbidden
404 Not found
500 Internal server error
The complete list:
100 Continue101 Switching protocols200 OK201 Created202 Accepted203 Non-authoritative information204 No content205 Reset content206 Partial content300 Multiple choices301 Moved permanently302 Moved temporarily303 See other304 Not modified305 Use proxy400 Bad request401 Unauthorized402 Payment required403 Forbidden404 Not found405 Method not allowed406 Not acceptable407 Proxy authentication required408 Request timeout409 Conflict410 Gone411 Length required412 Precondition failed413 Request entity too large414 Request-URI too long415 Unsupported media type500 Internal server error501 Not implemented502 Bad gateway503 Service unavailable504 Gateway timeout505 HTTP version not supported
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
13 of 77 4/14/2010 4:57 PM
Simple form with one field named "email".
GET
view plain print ?
GET /cgi-bin/echo.cgi?email=me%40example.com HTTP/1.1 1.Host: morpheus.dce.harvard.edu 2.User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Fire/3.6.3 (.NET CLR 3.5.30729)
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
20 of 77 4/14/2010 4:57 PM
String that identifies browser (vendor, version, OS).
Firefox 3.5 on WindowsMozilla/5.0 (Windows; U; Windows NT 5.1; en‐US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)
Google Chrome 4 on WindowsMozilla/5.0 (Windows; U; Windows NT 5.1; en‐US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1045Safari/532.5
Safari on iPadMozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en‐us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4Mobile/7B367 Safari/531.21.10
Safari on iPadMozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en‐us) AppleWebKit/528.18 (KHTML, like Gecko)Version/4.0 Mobile/7D11 Safari/528.16
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
22 of 77 4/14/2010 4:57 PM
How a Browser Knows What Kind of File it is Getting
Multipurpose Internet Mail Extensions (media types). Server will return a media type to client. Client will handle themedia appropriately. Some common media types are:
text/html
text/css
image/jpeg
image/png
image/gif
application/pdf
application/msword
application/vnd.ms‐excel
All media types listed in /etc/mime.types on morpheus
More information about MIME Types is available.
Questions:
How does the server know the media type?
How does the client know the media type?
How does the client know "what to do with" the file?
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
23 of 77 4/14/2010 4:57 PM
Resource can be in multiple formats and languages. Client preferences can determine which resource is returned.
</head><body> 24.<h1>Hello, David P. Heitmeyer</h1> 25.</body></html> 26.Connection closed by foreign host. 27. 28.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
35 of 77 4/14/2010 4:57 PM
Form that will set a Cookie:http://cscis12.dce.harvard.edu/http/cookie.cgi
view plain print ?
GET /http/cookie.cgi HTTP/1.1 1.Cookie: YourName=David%20P.%20Heitmeyer 2.Host: cscis12.dce.harvard.edu 3.Connection: close 4. 5.HTTP/1.1 200 OK 6.Connection: close 7.Date: Wed, 13 Apr 2008 18:11:40 GMT 8.Server: Apache/2.2 (Fedora) 9.Content-Type: text/html; charset=ISO-8859-1 10.Client-Date: Wed, 13 Apr 2008 18:11:40 GMT 11.Client-Peer: 140.247.197.241:80 12.Client-Response-Num: 1 13.Client-Transfer-Encoding: chunked 14. 15.<?xml version="1.0" encoding="iso-8859-1"?> 16.<!DOCTYPE html 17. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 18. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 19.<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> 20.<head><title>Form</title></head><body> 21.<h1>Hello, David P. Heitmeyer</h1> 22. 23.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
36 of 77 4/14/2010 4:57 PM
Firefox Webdeveloper Toolbar has a "Cookies" section.
Mozilla Cookie Manager
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
37 of 77 4/14/2010 4:57 PM
A UserID or SessionID (a long character/number string that is uniquely assigned) is often stored in cookie. The SessionIDis used as the key or identifier when storing information about the user or session.
For example, a user logs in to a site. If the username and password match, the server sets a cookie ("Set‐Cookie") in thebrowser that contains a session id; the server also makes an entry in website database that maps the session id to theusername. When the cookie is returned, the session id is read and the username is looked up in the database.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
38 of 77 4/14/2010 4:57 PM
Web‐based Distributed Authoring and Versioning
WebDAV Resourceshttp://www.webdav.org/
From the WebDAV Resources :
WebDAV stands for "Web‐based Distributed Authoring and Versioning". It is a set of extensions to theHTTP protocol which allows users to collaboratively edit and manage files on remote web servers.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
39 of 77 4/14/2010 4:57 PM
HTTP : the definitive guide, by David Gourley and Brian Totty
W3C HTTP
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
40 of 77 4/14/2010 4:57 PM
Apache HTTP Server
Microsoft IIS
Other
nginx
Google (Google Sites)
lighttpd
Web Server Market Share
Netcraft Web Server Survey
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
41 of 77 4/14/2010 4:57 PM
Apache Software Foundation
Apache HTTP Server Project
Apache 1.3
Apache 2.x
Apache Modules
PHP
Perl
Python
many, many others
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
42 of 77 4/14/2010 4:57 PM
Custom Error Documents
Redirect
Rewrite
Setting HTTP Expires Headers
Compressing content before delivery
Directory Index
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
43 of 77 4/14/2010 4:57 PM
Server Configuration (httpd.conf)Unless you are the server administrator, you generally will not have access to this account. On the DCE systems,you do not have read or write access to this file. Server configuration is read at server start or restart.
Per Directory (.htaccess)Certain configuration directives for Apache can be placed within per‐directory .htaccess files. .htaccess fileis read on a per request basis.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
45 of 77 4/14/2010 4:57 PM
Directives within .htaccess files apply to the directory that contains the .htaccess file and all its descendants.
Directives within the file,/home/courses/j/h/jharvard/public_html/.htaccess
would apply to all files within and "under" the public_html directory for the user jharvard.
Directives within the file,/home/courses/j/h/jharvard/books/.htaccess
would apply to all files within and "under" the public_html/books directory for the user jharvard.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
46 of 77 4/14/2010 4:57 PM
Internal Server Error
Can't "see" the file
Incorrect Permissions
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
47 of 77 4/14/2010 4:57 PM
500 Internal Server ErrorIf you see begin seeing 500 Internal Server Error responses from the server after you have created or edited an.htaccess file, the most likely cause of the problem is incorrect permissions and/or an error in the directive syntax.
Permissions on the .htaccess file are not set correctly. Just like HTML and image files, the server must be ableto read the .htaccess file. The simplest way to allow that is to make your .htaccess file readable by "other".
morpheus% pwd 1./home/courses/j/h/jharvard/public_html 2.morpheus% ls -l .htaccess 3.-rw------- 1 jharvard founder 349 Nov 27 00:03 .htaccess 4.morpheus% chmod o+r .htaccess 5.morpheus% ls -l ~/public_html/.htaccess 6.-rw----r-- 1 jharvard founder 349 Nov 27 00:03 .htaccess 7.
Syntax Error. An error in the syntax of a directive the .htaccess file will result in a 500 Internal Server Error. Inaddition, correct usage of a directive that is not allowed in the .htaccess file will result in a 500 status code.Whether or not a directive is allowed depends upon the server configuration file (httpd.conf; AllowOverride) andthe directive itself.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
48 of 77 4/14/2010 4:57 PM
You can't "see" your .htaccess file.
HTTPThe web server is typically configured to deny requests for .htaccess files. For example, the file correspondingto the URL, http://cscie12.dce.harvard.edu/.htaccess exists and is readable by the Web server, but if we try tofollow the link, we get a 403 Forbidden response.
UNIXThe ls command will not list files or directories that begin with a '.' (dot). In order to see the .htaccess filewhen you do a directory listing, use the ‐a (all) option:
SFTPSometimes your SFTP program will hide the "dot" files unless explicitly told to show them.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
49 of 77 4/14/2010 4:57 PM
Configuration directives can be limited by using "sections", such as
Directory
Location
Files
VirtualHost
DirectoryMatch
LocationMatch
FilesMatch
Within .htaccess
Note that only Files and FilesMatch can be used within .htaccess files.
Examples:
<Files .htaccess> 1. Order allow,deny 2. Deny from all 3.</Files> 4.
Examples:
# deny access to any tilde backup files 1.<Files *~> 2. Order allow,deny 3. Deny from all 4.</Files> 5.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
53 of 77 4/14/2010 4:57 PM
mod_rewrite uses regular expressions to match on a pattern and rewrite incoming URLs to a new URL location.
Apache mod_rewrite
mod_rewrite reference
Using mod_rewrite from within .htaccess
If you use RewriteRule from within an .htaccess files, you must use the RewriteBase directive.See: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritebase
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
54 of 77 4/14/2010 4:57 PM
Note: redirection may also be achieved on some browsers by using the http-equiv attribute of the <meta> element.The recommended method is to do it at the server level.
In html head element:
view plain print ?
<!-- in head --> 1.<!-- will redirect in 10 seconds --> 2.<meta http-equiv="Refresh" content="10; URL=http://www.harvard.edu/"/> 3.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
55 of 77 4/14/2010 4:57 PM
Module mod_expires
.htaccess
ExpiresActive On 1. 2.ExpiresByType text/html A3600 3.# HTML expires in 1 hour 4. 5.ExpiresByType image/gif A2592000 6.# GIF expires in 30 days 7. 8.ExpiresByType image/jpeg A2592000 9.# JPEG expires in 30 days 10. 11.ExpiresByType image/png A2592000 12.# PNG expires in 30 days 13. 14.# types not specified 15.ExpiresDefault "now plus 1 day" 16.# expires in 1 day 17.
Or, expire based upon modification time of document:ExpiresActive On 1.ExpiresByType text/html M86400 2.# HTML expires 1 day after it was last modified 3.ExpiresDefault M86400 4.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
56 of 77 4/14/2010 4:57 PM
If you do not want your page cached, set these HTTP response headers:
view plain print ?
Cache-control: no-cache 1.Pragma: no-cache 2.Expires: <set to now> 3.
In .htaccess in Apache, this would translate to:
ExpiresDefault "now" 1.Header set Pragma "no-cache" 2.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
57 of 77 4/14/2010 4:57 PM
mod_deflate compresses content before sending to web browser.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
63 of 77 4/14/2010 4:57 PM
Context: can these directives be in .htaccess files?
AllowOverride: is the server configured to allow this group of directives to be overriden in this location?
Is the required module loaded?
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
64 of 77 4/14/2010 4:57 PM
Certain Apache directives are legal within .htaccess files. Some are not.See the Apache Documentation for details. Specifically, look at the Context line that is given for the directive in question.
The following is an excerpt from the Apache HTTP Server Version 2.2 documentation
ErrorDocument directive
Syntax: ErrorDocument error‐code documentContext: server config, virtual host, directory, .htaccessStatus: coreOverride: FileInfoCompatibility: The directory and .htaccess contexts are only available in Apache 1.1 and later.
Also, the "a" indicator on the Apache Quick Reference Card indicates that the directive is valid within an .htaccessfile.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
65 of 77 4/14/2010 4:57 PM
Users are allowed to override certain aspects of the main server configuration.The main server configuration file (httpd.conf) contains an AllowOverride directive that determines which directiveswithin .htaccess files Apache will process. The Override line that is given for each directive in the Apachedocumentation indicates which configuration directive must be active in order to use that directive with an .htaccessfile.
For the FAS system, the main server configuration file has the following directive in place for users' public_htmldirectories:
Syntax: ErrorDocument error‐code documentContext: server config, virtual host, directory, .htaccessStatus: coreOverride: FileInfoCompatibility: The directory and .htaccess contexts are only available in Apache 1.1 and later.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
66 of 77 4/14/2010 4:57 PM
Apache is distributed with several modules. These modules may or may not be active within the Apache server withwhich you are working. The Core features will always be available.
For example, if the Rewrite Module (mod_rewrite) has not been activated, none of the Rewrite directives will beavailable to use.
Refer to the Status and Module lines in the documentation for each directive and to the documentation for the specificApache installation you are using.
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
67 of 77 4/14/2010 4:57 PM
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
68 of 77 4/14/2010 4:57 PM
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
69 of 77 4/14/2010 4:57 PM
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
70 of 77 4/14/2010 4:57 PM
Data Collection
Email
Database
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
71 of 77 4/14/2010 4:57 PM
FormMail Documentation. Note that this script can be used to send email only to addresses ending with .harvard.edu
action
http://morpheus.dce.harvard.edu/cgi‐bin/FormMail
parameters
recipient
subject
email
redirect
required
sort
env_report
print_config
print_blank_fields
...see documentation for complete list
CSCI E-12 - April 14, 2010- Presentation and Cascading Style Sheets http://tomcat.localhost/cocoon/course_webdev/slides/20100414/handout.html
72 of 77 4/14/2010 4:57 PM
Example 11.1 ‐ Server Program: FormMail ‐ View example by itself
FAS IT offers a Data Collection Tool that allows you to send data submitted via an HTML form to a database. The data canbe viewed online (in HTML) or downloaded in an Excel file. Note that a Harvard HUID and PIN are required to use thistool.
Example 11.3 ‐ Data Collection Tool from FAS IT ‐ View example by itself