1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5              This file is generated from xml source: DO NOT EDIT
6        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7      -->
8<title>mod_actions - Apache HTTP Server</title>
9<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
12<script src="/style/scripts/prettify.js" type="text/javascript">
13</script>
14
15<link href="/images/favicon.ico" rel="shortcut icon" /></head>
16<body>
17<div id="page-header">
18<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
19<p class="apache">Apache HTTP Server Version 2.2</p>
20<img alt="" src="/images/feather.gif" /></div>
21<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
22<div id="path">
23<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.2</a> &gt; <a href="./">Modules</a></div>
24<div id="page-content">
25<div id="preamble"><h1>Apache Module mod_actions</h1>
26<div class="toplang">
27<p><span>Available Languages: </span><a href="/de/mod/mod_actions.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
28<a href="/en/mod/mod_actions.html" title="English">&nbsp;en&nbsp;</a> |
29<a href="/ja/mod/mod_actions.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
30<a href="/ko/mod/mod_actions.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
31</div>
32<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>This module provides for executing CGI scripts based on
33media type or request method.</td></tr>
34<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
35<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>actions_module</td></tr>
36<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_actions.c</td></tr></table>
37<h3>Summary</h3>
38
39    <p>This module has two directives. The <code class="directive"><a href="#action">Action</a></code> directive lets you run CGI
40    scripts whenever a file of a certain <a class="glossarylink" href="/glossary.html#mime-type" title="see glossary">MIME content type</a> is requested. The
41    <code class="directive"><a href="#script">Script</a></code> directive lets
42    you run CGI scripts whenever a particular method is used in a
43    request. This makes it much easier to execute scripts that process
44    files.</p> </div>
45<div id="quickview"><h3 class="directives">Directives</h3>
46<ul id="toc">
47<li><img alt="" src="/images/down.gif" /> <a href="#action">Action</a></li>
48<li><img alt="" src="/images/down.gif" /> <a href="#script">Script</a></li>
49</ul>
50<h3>See also</h3>
51<ul class="seealso">
52<li><code class="module"><a href="/mod/mod_cgi.html">mod_cgi</a></code></li>
53<li><a href="/howto/cgi.html">Dynamic Content with CGI</a></li>
54<li><a href="/handler.html">Apache's Handler Use</a></li>
55</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
56
57<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
58<div class="directive-section"><h2><a name="Action" id="Action">Action</a> <a name="action" id="action">Directive</a></h2>
59<table class="directive">
60<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Activates a CGI script for a particular handler or
61content-type</td></tr>
62<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Action <var>action-type</var> <var>cgi-script</var> [virtual]</code></td></tr>
63<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
64<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
65<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
66<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_actions</td></tr>
67<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The <code>virtual</code> modifier and handler passing were
68introduced in Apache 2.1</td></tr>
69</table>
70    <p>This directive adds an action, which will activate
71    <var>cgi-script</var> when <var>action-type</var> is triggered by
72    the request.  The <var>cgi-script</var> is the URL-path to a
73    resource that has been designated as a CGI script using <code class="directive"><a href="/mod/mod_alias.html#scriptalias">ScriptAlias</a></code> or <code class="directive"><a href="/mod/mod_mime.html#addhandler">AddHandler</a></code>.  The
74    <var>action-type</var> can be either a <a href="/handler.html">handler</a> or a <a class="glossarylink" href="/glossary.html#mime-type" title="see glossary">MIME content type</a>. It sends the URL and
75    file path of the requested document using the standard CGI
76    <code>PATH_INFO</code> and <code>PATH_TRANSLATED</code>
77    environment variables. The handler used for the particular request
78    is passed using the <code>REDIRECT_HANDLER</code> variable.</p>
79
80    <div class="example"><h3>Examples</h3><p><code>
81      # Requests for files of a particular MIME content type:<br />
82      Action image/gif /cgi-bin/images.cgi<br />
83      <br />
84      # Files of a particular file extension<br />
85      AddHandler my-file-type .xyz<br />
86      Action my-file-type /cgi-bin/program.cgi<br />
87    </code></p></div>
88
89    <p>In the first example, requests for files with a MIME content
90    type of <code>image/gif</code> will be handled by the
91    specified cgi script <code>/cgi-bin/images.cgi</code>.</p>
92
93    <p>In the second example, requests for files with a file extension of
94    <code>.xyz</code> are handled by the specified cgi script 
95    <code>/cgi-bin/program.cgi</code>.</p>
96
97    <p>The optional <code>virtual</code> modifier turns off the check
98    whether the requested file really exists. This is useful, for example,
99    if you want to use the <code class="directive">Action</code> directive in
100    virtual locations.</p>
101
102    <div class="example"><h3>Example</h3><p><code>
103      &lt;Location /news&gt;<br />
104      <span class="indent">
105        SetHandler news-handler<br />
106        Action news-handler /cgi-bin/news.cgi virtual<br />
107      </span>
108      &lt;/Location&gt;
109    </code></p></div>
110
111<h3>See also</h3>
112<ul>
113<li><code class="directive"><a href="/mod/mod_mime.html#addhandler">AddHandler</a></code></li>
114</ul>
115</div>
116<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
117<div class="directive-section"><h2><a name="Script" id="Script">Script</a> <a name="script" id="script">Directive</a></h2>
118<table class="directive">
119<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Activates a CGI script for a particular request
120method.</td></tr>
121<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Script <var>method</var> <var>cgi-script</var></code></td></tr>
122<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
123<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
124<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_actions</td></tr>
125</table>
126    <p>This directive adds an action, which will activate
127    <var>cgi-script</var> when a file is requested using the method of
128    <var>method</var>. The <var>cgi-script</var> is the URL-path to a
129    resource that has been designated as a CGI script using <code class="directive"><a href="/mod/mod_alias.html#scriptalias">ScriptAlias</a></code> or <code class="directive"><a href="/mod/mod_mime.html#addhandler">AddHandler</a></code>.  The URL and
130    file path of the requested document is sent using the standard CGI
131    <code>PATH_INFO</code> and <code>PATH_TRANSLATED</code> environment 
132    variables.</p>
133
134    <div class="note">
135      Any arbitrary method name may be used. <strong>Method names are
136      case-sensitive</strong>, so <code>Script PUT</code> and
137      <code>Script put</code> have two entirely different
138      effects.
139    </div>
140
141    <p>Note that the <code class="directive">Script</code> command defines default 
142    actions only. If a CGI script is called, or some other resource that is
143    capable of handling the requested method internally, it will do
144    so. Also note that <code class="directive">Script</code> with a method of 
145    <code>GET</code> will only be called if there are query arguments present
146    (<em>e.g.</em>, foo.html?hi). Otherwise, the request will
147    proceed normally.</p>
148
149    <div class="example"><h3>Examples</h3><p><code>
150      # For &lt;ISINDEX&gt;-style searching<br />
151      Script GET /cgi-bin/search<br />
152      <br />
153      # A CGI PUT handler<br />
154      Script PUT /~bob/put.cgi<br />
155    </code></p></div>
156
157</div>
158</div>
159<div class="bottomlang">
160<p><span>Available Languages: </span><a href="/de/mod/mod_actions.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
161<a href="/en/mod/mod_actions.html" title="English">&nbsp;en&nbsp;</a> |
162<a href="/ja/mod/mod_actions.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
163<a href="/ko/mod/mod_actions.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
164</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
165<script type="text/javascript"><!--//--><![CDATA[//><!--
166var comments_shortname = 'httpd';
167var comments_identifier = 'http://httpd.apache.org/docs/2.2/mod/mod_actions.html';
168(function(w, d) {
169    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
170        d.write('<div id="comments_thread"><\/div>');
171        var s = d.createElement('script');
172        s.type = 'text/javascript';
173        s.async = true;
174        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
175        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
176    }
177    else { 
178        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
179    }
180})(window, document);
181//--><!]]></script></div><div id="footer">
182<p class="apache">Copyright 2013 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
183<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
184if (typeof(prettyPrint) !== 'undefined') {
185    prettyPrint();
186}
187//--><!]]></script>
188</body></html>