Defining Content Handlers


AddHandler cgi-script .pl .cgi <Location "/cgi-bin/*.pl"> Options +ExecCGI SetHandler cgi-script </Location>


Handlers are a way Apache determines which actions to perform on the requested content. Modules provide handlers, and you configure Apache to associate certain content with specific handlers. This functionality is commonly used with content-generation modules such as PHP and mod_cgi. The example shows how to associate the cgi-handler handler with the files you want to run as CGIs.

The AddHandler directive associates a certain handler with filename extensions. RemoveHandler can be used to remove previous associations. In the example, AddHandler tells Apache to treat all documents with cgi or pl extensions as CGI scripts.

The SetHandler directive enables you to associate a handler with all files in a particular directory or location. The Action directive, described later in this chapter, enables you to associate a particular MIME type or handler with a CGI script.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net