home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / apache_2.2.8-win32-x86-no_ssl.msi / Data1.cab / _D46A638673C130FF402F817973BF6A38 < prev    next >
Extensible Markup Language  |  2007-09-01  |  16KB  |  285 lines

  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_setenvif - 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" />
  12. <link href="../images/favicon.ico" rel="shortcut icon" /></head>
  13. <body>
  14. <div id="page-header">
  15. <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
  16. <p class="apache">Apache HTTP Server Version 2.2</p>
  17. <img alt="" src="../images/feather.gif" /></div>
  18. <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
  19. <div id="path">
  20. <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.2</a> > <a href="./">Modules</a></div>
  21. <div id="page-content">
  22. <div id="preamble"><h1>Apache Module mod_setenvif</h1>
  23. <div class="toplang">
  24. <p><span>Available Languages: </span><a href="../en/mod/mod_setenvif.html" title="English"> en </a> |
  25. <a href="../ja/mod/mod_setenvif.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
  26. <a href="../ko/mod/mod_setenvif.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
  27. </div>
  28. <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Allows the setting of environment variables based
  29. on characteristics of the request</td></tr>
  30. <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
  31. <tr><th><a href="module-dict.html#ModuleIdentifier">ModuleáIdentifier:</a></th><td>setenvif_module</td></tr>
  32. <tr><th><a href="module-dict.html#SourceFile">SourceáFile:</a></th><td>mod_setenvif.c</td></tr></table>
  33. <h3>Summary</h3>
  34.  
  35.  
  36.     <p>The <code class="module"><a href="../mod/mod_setenvif.html">mod_setenvif</a></code> module allows you to set
  37.     environment variables according to whether different aspects of
  38.     the request match regular expressions you specify. These
  39.     environment variables can be used by other parts of the server
  40.     to make decisions about actions to be taken.</p>
  41.  
  42.     <p>The directives are considered in the order they appear in
  43.     the configuration files. So more complex sequences can be used,
  44.     such as this example, which sets <code>netscape</code> if the
  45.     browser is mozilla but not MSIE.</p>
  46.  
  47. <div class="example"><p><code>
  48.   BrowserMatch ^Mozilla netscape<br />
  49.   BrowserMatch MSIE !netscape<br />
  50. </code></p></div>
  51. </div>
  52. <div id="quickview"><h3 class="directives">Directives</h3>
  53. <ul id="toc">
  54. <li><img alt="" src="../images/down.gif" /> <a href="#browsermatch">BrowserMatch</a></li>
  55. <li><img alt="" src="../images/down.gif" /> <a href="#browsermatchnocase">BrowserMatchNoCase</a></li>
  56. <li><img alt="" src="../images/down.gif" /> <a href="#setenvif">SetEnvIf</a></li>
  57. <li><img alt="" src="../images/down.gif" /> <a href="#setenvifnocase">SetEnvIfNoCase</a></li>
  58. </ul>
  59. <h3>See also</h3>
  60. <ul class="seealso">
  61. <li><a href="../env.html">Environment Variables in Apache</a></li>
  62. </ul></div>
  63.  
  64. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  65. <div class="directive-section"><h2><a name="BrowserMatch" id="BrowserMatch">BrowserMatch</a> <a name="browsermatch" id="browsermatch">Directive</a></h2>
  66. <table class="directive">
  67. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets environment variables conditional on HTTP User-Agent
  68. </td></tr>
  69. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BrowserMatch <em>regex [!]env-variable</em>[=<em>value</em>]
  70. [[!]<em>env-variable</em>[=<em>value</em>]] ...</code></td></tr>
  71. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
  72. <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
  73. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
  74. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_setenvif</td></tr>
  75. </table>
  76.   <p>The <code class="directive">BrowserMatch</code> is a special cases of the
  77.   <code class="directive"><a href="#setenvif">SetEnvIf</a></code> directive that
  78.   sets environment variables conditional on the
  79.   <code>User-Agent</code> HTTP request header.  The following two
  80.   lines have the same effect:</p>
  81. <div class="example"><p><code>
  82.    BrowserMatchNoCase Robot is_a_robot<br /> 
  83.    SetEnvIfNoCase User-Agent Robot is_a_robot<br /> 
  84. </code></p></div>
  85.  
  86.     <p>Some additional examples:</p>
  87. <div class="example"><p><code>
  88.     BrowserMatch ^Mozilla forms jpeg=yes browser=netscape<br />
  89.     BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript<br />
  90.     BrowserMatch MSIE !javascript<br />
  91. </code></p></div>
  92.  
  93. </div>
  94. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  95. <div class="directive-section"><h2><a name="BrowserMatchNoCase" id="BrowserMatchNoCase">BrowserMatchNoCase</a> <a name="browsermatchnocase" id="browsermatchnocase">Directive</a></h2>
  96. <table class="directive">
  97. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets environment variables conditional on User-Agent without
  98. respect to case</td></tr>
  99. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BrowserMatchNoCase  <em>regex [!]env-variable</em>[=<em>value</em>]
  100.     [[!]<em>env-variable</em>[=<em>value</em>]] ...</code></td></tr>
  101. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
  102. <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
  103. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
  104. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_setenvif</td></tr>
  105. <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Apache 1.2 and
  106.     above (in Apache 1.2 this directive was found in the
  107.     now-obsolete mod_browser module)</td></tr>
  108. </table>
  109.  
  110.     <p>The <code class="directive">BrowserMatchNoCase</code> directive is
  111.     semantically identical to the <code class="directive"><a href="#browsermatch">BrowserMatch</a></code> directive.
  112.     However, it provides for case-insensitive matching. For
  113.     example:</p>
  114. <div class="example"><p><code>
  115.     BrowserMatchNoCase mac platform=macintosh<br />
  116.     BrowserMatchNoCase win platform=windows<br />
  117. </code></p></div>
  118.  
  119.     <p>The <code class="directive">BrowserMatch</code> and
  120.     <code class="directive">BrowserMatchNoCase</code> directives are special cases of
  121.     the <code class="directive"><a href="#setenvif">SetEnvIf</a></code> and <code class="directive"><a href="#setenvifnocase">SetEnvIfNoCase</a></code>
  122.     directives. The following two lines have the same effect:</p>
  123. <div class="example"><p><code>
  124.    BrowserMatchNoCase Robot is_a_robot<br />
  125.    SetEnvIfNoCase User-Agent Robot is_a_robot<br />
  126. </code></p></div>
  127.  
  128. </div>
  129. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  130. <div class="directive-section"><h2><a name="SetEnvIf" id="SetEnvIf">SetEnvIf</a> <a name="setenvif" id="setenvif">Directive</a></h2>
  131. <table class="directive">
  132. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets environment variables based on attributes of the request
  133. </td></tr>
  134. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetEnvIf <em>attribute
  135.     regex [!]env-variable</em>[=<em>value</em>]
  136.     [[!]<em>env-variable</em>[=<em>value</em>]] ...</code></td></tr>
  137. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
  138. <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
  139. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
  140. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_setenvif</td></tr>
  141. </table>
  142.     <p>The <code class="directive">SetEnvIf</code> directive defines
  143.     environment variables based on attributes of the request. The
  144.     <em>attribute</em> specified in the first argument can be one of three
  145.     things:</p>
  146.  
  147. <ol>
  148. <li>An HTTP request header field (see <a href="http://www.rfc-editor.org/rfc/rfc2616.txt">RFC2616</a>
  149.     for more information about these); for example: <code>Host</code>,
  150.     <code>User-Agent</code>, <code>Referer</code>, and 
  151.     <code>Accept-Language</code>.  A regular expression may be
  152.     used to specify a set of request headers.</li>
  153.  
  154. <li>One of the following aspects of the request:
  155.     <ul>
  156.       <li><code>Remote_Host</code> - the hostname (if available) of
  157.       the client making the request</li>
  158.  
  159.       <li><code>Remote_Addr</code> - the IP address of the client
  160.       making the request</li>
  161.  
  162.       <li><code>Server_Addr</code> - the IP address of the server
  163.       on which the request was received (only with versions later
  164.       than 2.0.43)</li>
  165.  
  166.       <li><code>Request_Method</code> - the name of the method
  167.       being used (<code>GET</code>, <code>POST</code>, <em>et
  168.       cetera</em>)</li>
  169.  
  170.       <li><code>Request_Protocol</code> - the name and version of
  171.       the protocol with which the request was made (<em>e.g.</em>,
  172.       "HTTP/0.9", "HTTP/1.1", <em>etc.</em>)</li>
  173.  
  174.       <li><code>Request_URI</code> - the resource requested on the HTTP
  175.        request line -- generally the portion of the URL
  176.       following the scheme and host portion without the query string</li>
  177.     </ul>
  178. </li>
  179.  
  180. <li>The name of an environment variable in the list of those
  181. associated with the request. This allows
  182. <code class="directive">SetEnvIf</code> directives to test against the result
  183. of prior matches. Only those environment variables defined by earlier
  184. <code>SetEnvIf[NoCase]</code> directives are available for testing in
  185. this manner. 'Earlier' means that they were defined at a broader scope
  186. (such as server-wide) or previously in the current directive's scope.
  187. Environment variables will be considered only if there was no match
  188. among request characteristics and a regular expression was not
  189. used for the <em>attribute</em>.</li>
  190. </ol>
  191.  
  192. <p>The second argument (<em>regex</em>) is a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>.  If the <em>regex</em>
  193. matches against the <em>attribute</em>, then the remainder of the
  194. arguments are evaluated.</p>
  195.  
  196. <p>The rest of the arguments give the names of variables to set, and
  197. optionally values to which they should be set. These take the form
  198. of</p>
  199.  
  200.     <ol>
  201.       <li><code><em>varname</em></code>, or</li>
  202.  
  203.       <li><code>!<em>varname</em></code>, or</li>
  204.  
  205.       <li><code><em>varname</em>=<em>value</em></code></li>
  206.     </ol>
  207.  
  208.     <p>In the first form, the value will be set to "1". The second
  209.     will remove the given variable if already defined, and the
  210.     third will set the variable to the literal value given by
  211.     <code><em>value</em></code>. Since version 2.0.51 Apache will
  212.     recognize occurrences of <code>$1</code>..<code>$9</code> within
  213.     <var>value</var> and replace them by parenthesized subexpressions
  214.     of <var>regex</var>.</p>
  215.  
  216. <div class="example"><h3>Example:</h3><p><code>
  217.  
  218.    SetEnvIf Request_URI "\.gif$" object_is_image=gif<br />
  219.    SetEnvIf Request_URI "\.jpg$" object_is_image=jpg<br />
  220.    SetEnvIf Request_URI "\.xbm$" object_is_image=xbm<br />
  221.         :<br />
  222.    SetEnvIf Referer www\.mydomain\.com intra_site_referral<br />
  223.         :<br />
  224.    SetEnvIf object_is_image xbm XBIT_PROCESSING=1<br />
  225.         :<br />
  226.    SetEnvIf ^TS*  ^[a-z].*  HAVE_TS<br />
  227. </code></p></div>
  228.  
  229.     <p>The first three will set the environment variable
  230.     <code>object_is_image</code> if the request was for an image
  231.     file, and the fourth sets <code>intra_site_referral</code> if
  232.     the referring page was somewhere on the
  233.     <code>www.mydomain.com</code> Web site.</p>
  234.  
  235.     <p>The last example will set environment variable
  236.     <code>HAVE_TS</code> if the request contains any headers that
  237.     begin with "TS" whose values begins with any character in the
  238.     set [a-z].</p>
  239.  
  240. <h3>See also</h3>
  241. <ul>
  242. <li><a href="../env.html">Environment Variables in Apache</a>,
  243. for additional examples.
  244. </li>
  245. </ul>
  246. </div>
  247. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  248. <div class="directive-section"><h2><a name="SetEnvIfNoCase" id="SetEnvIfNoCase">SetEnvIfNoCase</a> <a name="setenvifnocase" id="setenvifnocase">Directive</a></h2>
  249. <table class="directive">
  250. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets environment variables based on attributes of the request
  251. without respect to case</td></tr>
  252. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SetEnvIfNoCase <em>attribute regex 
  253.         [!]env-variable</em>[=<em>value</em>]
  254.     [[!]<em>env-variable</em>[=<em>value</em>]] ...</code></td></tr>
  255. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
  256. <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
  257. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
  258. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_setenvif</td></tr>
  259. <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Apache 1.3 and above</td></tr>
  260. </table>
  261.  
  262.     <p>The <code class="directive">SetEnvIfNoCase</code> is semantically identical to
  263.     the <code class="directive"><a href="#setenvif">SetEnvIf</a></code> directive,
  264.     and differs only in that the regular expression matching is
  265.     performed in a case-insensitive manner. For example:</p>
  266. <div class="example"><p><code>
  267.    SetEnvIfNoCase Host Apache\.Org site=apache
  268. </code></p></div>
  269.  
  270.     <p>This will cause the <code>site</code> environment variable
  271.     to be set to "<code>apache</code>" if the HTTP request header
  272.     field <code>Host:</code> was included and contained
  273.     <code>Apache.Org</code>, <code>apache.org</code>, or any other
  274.     combination.</p>
  275.  
  276. </div>
  277. </div>
  278. <div class="bottomlang">
  279. <p><span>Available Languages: </span><a href="../en/mod/mod_setenvif.html" title="English"> en </a> |
  280. <a href="../ja/mod/mod_setenvif.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
  281. <a href="../ko/mod/mod_setenvif.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
  282. </div><div id="footer">
  283. <p class="apache">Copyright 2007 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>
  284. <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
  285. </body></html>