<p>The usage of these directives is:</p>
- <div class="example"><p><code>
- Require host <var>address</var><br />
+ <pre class="prettyprint lang-config">
+ Require host <var>address</var>
Require ip <var>ip.address</var>
- </code></p></div>
+ </pre>
+
<p>In the first form, <var>address</var> is a fully qualified
domain name (or a partial domain name); you may provide multiple
<p>And, if you'd like to block access from an entire domain,
you can specify just part of an address or domain name:</p>
- <div class="example"><p><code>
- Require not ip <var>192.168.205</var><br />
- Require not host <var>phishers.example.com</var> <var>moreidiots.example</var><br />
+ <pre class="prettyprint lang-config">
+ Require not ip <var>192.168.205</var>
+ Require not host <var>phishers.example.com</var> <var>moreidiots.example</var>
Require not gov
- </code></p></div>
+ </pre>
+
<p>Use of the <code class="directive"><a href="../mod/mod_authz_core.html#requireall">RequireAll</a></code>, <code class="directive"><a href="../mod/mod_authz_core.html#requireany">RequireAny</a></code>, and <code class="directive"><a href="../mod/mod_authz_core.html#requirenone">RequireNone</a></code> directives may be
used to enforce more complex sets of requirements.</p>
based on user-agent (the browser type) you might do the
following:</p>
- <div class="example"><p><code>
- <If "%{HTTP_USER_AGENT} = 'BadBot'"><br />
- <span class="indent">
- Require All Denied<br />
- </span>
+ <pre class="prettyprint lang-config">
+ <If "%{HTTP_USER_AGENT} = 'BadBot'">
+ Require All Denied
</If>
- </code></p></div>
+ </pre>
+
<div class="note"><h3>Warning:</h3>
<p>Access control by <code>User-Agent</code> is an unreliable technique,
<p>For example, if you wish to block access to a resource between 8pm
and 6am, you can do this using <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>.</p>
- <div class="example"><p><code>
- RewriteEngine On<br />
- RewriteCond %{TIME_HOUR} >20 [OR]<br />
- RewriteCond %{TIME_HOUR} <07<br />
+ <pre class="prettyprint lang-config">
+ RewriteEngine On
+ RewriteCond %{TIME_HOUR} >20 [OR]
+ RewriteCond %{TIME_HOUR} <07
RewriteRule ^/fridge - [F]
- </code></p></div>
+ </pre>
+
<p>This will return a 403 Forbidden response for any request after 8pm
or before 7am. This technique can be used for any criteria that you wish
<p>The usage of these directives is:</p>
- <example>
- Require host <var>address</var><br />
+ <highlight language="config">
+ Require host <var>address</var>
Require ip <var>ip.address</var>
- </example>
+ </highlight>
<p>In the first form, <var>address</var> is a fully qualified
domain name (or a partial domain name); you may provide multiple
<p>And, if you'd like to block access from an entire domain,
you can specify just part of an address or domain name:</p>
- <example>
- Require not ip <var>192.168.205</var><br />
- Require not host <var>phishers.example.com</var> <var>moreidiots.example</var><br />
+ <highlight language="config">
+ Require not ip <var>192.168.205</var>
+ Require not host <var>phishers.example.com</var> <var>moreidiots.example</var>
Require not gov
- </example>
+ </highlight>
<p>Use of the <directive
module="mod_authz_core">RequireAll</directive>, <directive
based on user-agent (the browser type) you might do the
following:</p>
- <example>
- <If "%{HTTP_USER_AGENT} = 'BadBot'"><br />
- <indent>
- Require All Denied<br />
- </indent>
+ <highlight language="config">
+ <If "%{HTTP_USER_AGENT} = 'BadBot'">
+ Require All Denied
</If>
- </example>
+ </highlight>
<note><title>Warning:</title>
<p>Access control by <code>User-Agent</code> is an unreliable technique,
<p>For example, if you wish to block access to a resource between 8pm
and 6am, you can do this using <module>mod_rewrite</module>.</p>
- <example>
- RewriteEngine On<br />
- RewriteCond %{TIME_HOUR} >20 [OR]<br />
- RewriteCond %{TIME_HOUR} <07<br />
+ <highlight language="config">
+ RewriteEngine On
+ RewriteCond %{TIME_HOUR} >20 [OR]
+ RewriteCond %{TIME_HOUR} <07
RewriteRule ^/fridge - [F]
- </example>
+ </highlight>
<p>This will return a 403 Forbidden response for any request after 8pm
or before 7am. This technique can be used for any criteria that you wish
an <code class="directive"><a href="../mod/core.html#allowoverride">AllowOverride</a></code> directive like the
following:</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
AllowOverride AuthConfig
- </code></p></div>
+ </pre>
+
<p>Or, if you are just going to put the directives directly in
your main server configuration file, you will of course need to
placed in <code>httpd.conf</code> inside a <Directory
/usr/local/apache/htdocs/secret> section.</p>
- <div class="example"><p><code>
- AuthType Basic<br />
- AuthName "Restricted Files"<br />
- # (Following line optional)<br />
- AuthBasicProvider file<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
+ <pre class="prettyprint lang-config">
+ AuthType Basic
+ AuthName "Restricted Files"
+ # (Following line optional)
+ AuthBasicProvider file
+ AuthUserFile /usr/local/apache/passwd/passwords
Require user rbowen
- </code></p></div>
+ </pre>
+
<p>Let's examine each of those directives individually. The <code class="directive"><a href="../mod/mod_authn_core.html#authtype">AuthType</a></code> directive selects
that method that is used to authenticate the user. The most
<p>Now, you need to modify your <code>.htaccess</code> file to
look like the following:</p>
- <div class="example"><p><code>
- AuthType Basic<br />
- AuthName "By Invitation Only"<br />
- # Optional line:<br />
- AuthBasicProvider file<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- AuthGroupFile /usr/local/apache/passwd/groups<br />
+ <pre class="prettyprint lang-config">
+ AuthType Basic
+ AuthName "By Invitation Only"
+ # Optional line:
+ AuthBasicProvider file
+ AuthUserFile /usr/local/apache/passwd/passwords
+ AuthGroupFile /usr/local/apache/passwd/groups
Require group GroupName
- </code></p></div>
+ </pre>
+
<p>Now, anyone that is listed in the group <code>GroupName</code>,
and has an entry in the <code>password</code> file, will be let in, if
<p>To select a dbd file rather than a text file, for example:</p>
- <div class="example"><p><code>
- <Directory /www/docs/private><br />
- <span class="indent">
- AuthName "Private"<br />
- AuthType Basic<br />
- AuthBasicProvider dbm<br />
- AuthDBMUserFile /www/passwords/passwd.dbm<br />
- Require valid-user<br />
- </span>
+ <pre class="prettyprint lang-config">
+ <Directory /www/docs/private>
+ AuthName "Private"
+ AuthType Basic
+ AuthBasicProvider dbm
+ AuthDBMUserFile /www/passwords/passwd.dbm
+ Require valid-user
</Directory>
- </code></p></div>
+ </pre>
+
<p>Other options are available. Consult the
<code class="module"><a href="../mod/mod_authn_dbm.html">mod_authn_dbm</a></code> documentation for more details.</p>
scheme that meets your needs. In the following example, both the
file and LDAP based authentication providers are being used.</p>
- <div class="example"><p><code>
- <Directory /www/docs/private><br />
- <span class="indent">
- AuthName "Private"<br />
- AuthType Basic<br />
- AuthBasicProvider file ldap<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- AuthLDAPURL ldap://ldaphost/o=yourorg<br />
- Require valid-user<br />
- </span>
+ <pre class="prettyprint lang-config">
+ <Directory /www/docs/private>
+ AuthName "Private"
+ AuthType Basic
+ AuthBasicProvider file ldap
+ AuthUserFile /usr/local/apache/passwd/passwords
+ AuthLDAPURL ldap://ldaphost/o=yourorg
+ Require valid-user
</Directory>
- </code></p></div>
+ </pre>
+
<p>In this example the file provider will attempt to authenticate
the user first. If it is unable to authenticate the user, the LDAP
authorization methods can also be used. In this example both file group
authorization as well as LDAP group authorization is being used.</p>
- <div class="example"><p><code>
- <Directory /www/docs/private><br />
- <span class="indent">
- AuthName "Private"<br />
- AuthType Basic<br />
- AuthBasicProvider file<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- AuthLDAPURL ldap://ldaphost/o=yourorg
- AuthGroupFile /usr/local/apache/passwd/groups<br />
- Require group GroupName<br />
- Require ldap-group cn=mygroup,o=yourorg<br />
- </span>
+ <pre class="prettyprint lang-config">
+ <Directory /www/docs/private>
+ AuthName "Private"
+ AuthType Basic
+ AuthBasicProvider file
+ AuthUserFile /usr/local/apache/passwd/passwords
+ AuthLDAPURL ldap://ldaphost/o=yourorg
+ AuthGroupFile /usr/local/apache/passwd/groups
+ Require group GroupName
+ Require ldap-group cn=mygroup,o=yourorg
</Directory>
- </code></p></div>
+ </pre>
+
<p>To take authorization a little further, authorization container
directives such as
that will be called during the authorization stage of the request
processing. For example:</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
Require ip <var>address</var>
- </code></p></div>
+ </pre>
+
<p>where <var>address</var> is an IP address (or a partial IP
address) or:</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
Require host <var>domain_name</var>
- </code></p></div>
+ </pre>
+
<p>where <var>domain_name</var> is a fully qualified domain name
(or a partial domain name); you may provide multiple addresses or
board, and you want to keep them out, you could do the
following:</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
<RequireAll>
- <span class="indent">
- Require all granted<br />
+ Require all granted
Require not ip 10.252.46.165
- </span>
</RequireAll>
- </code></p></div>
+ </pre>
+
<p>Visitors coming from that address will not be able to see
the content covered by this directive. If, instead, you have a
machine name, rather than an IP address, you can use that.</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
<RequireAll>
- <span class="indent">
- Require all granted<br />
+ Require all granted
Require not host <var>host.example.com</var>
- </span>
</RequireAll>
- </code></p></div>
+ </pre>
+
<p>And, if you'd like to block access from an entire domain,
you can specify just part of an address or domain name:</p>
- <div class="example"><p><code>
- <RequireAll>
- <span class="indent">
- Require all granted<br />
- <RequireNone>
- <span class="indent">
- Require ip 192.168.205<br />
- Require host phishers.example.com moreidiots.example<br />
- Require host ke
- </span>
- </RequireNone>
- </span>
- </RequireAll>
- </code></p></div>
+ <pre class="prettyprint lang-config">
+ <RequireAll>
+ Require all granted
+ <RequireNone>
+ Require ip 192.168.205
+ Require host phishers.example.com moreidiots.example
+ Require host ke
+ </RequireNone>
+ </RequireAll>
+ </pre>
+
<p>The above example uses the <code class="directive"><a href="../mod/mod_authz_core.html#requirenone"><RequireNone></a></code> directive
to make sure that none of the
an <directive module="core">AllowOverride</directive> directive like the
following:</p>
- <example>
+ <highlight language="config">
AllowOverride AuthConfig
- </example>
+ </highlight>
<p>Or, if you are just going to put the directives directly in
your main server configuration file, you will of course need to
placed in <code>httpd.conf</code> inside a <Directory
/usr/local/apache/htdocs/secret> section.</p>
- <example>
- AuthType Basic<br />
- AuthName "Restricted Files"<br />
- # (Following line optional)<br />
- AuthBasicProvider file<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
+ <highlight language="config">
+ AuthType Basic
+ AuthName "Restricted Files"
+ # (Following line optional)
+ AuthBasicProvider file
+ AuthUserFile /usr/local/apache/passwd/passwords
Require user rbowen
- </example>
+ </highlight>
<p>Let's examine each of those directives individually. The <directive
module="mod_authn_core">AuthType</directive> directive selects
<p>Now, you need to modify your <code>.htaccess</code> file to
look like the following:</p>
- <example>
- AuthType Basic<br />
- AuthName "By Invitation Only"<br />
- # Optional line:<br />
- AuthBasicProvider file<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- AuthGroupFile /usr/local/apache/passwd/groups<br />
+ <highlight language="config">
+ AuthType Basic
+ AuthName "By Invitation Only"
+ # Optional line:
+ AuthBasicProvider file
+ AuthUserFile /usr/local/apache/passwd/passwords
+ AuthGroupFile /usr/local/apache/passwd/groups
Require group GroupName
- </example>
+ </highlight>
<p>Now, anyone that is listed in the group <code>GroupName</code>,
and has an entry in the <code>password</code> file, will be let in, if
<p>To select a dbd file rather than a text file, for example:</p>
- <example>
- <Directory /www/docs/private><br />
- <indent>
- AuthName "Private"<br />
- AuthType Basic<br />
- AuthBasicProvider dbm<br />
- AuthDBMUserFile /www/passwords/passwd.dbm<br />
- Require valid-user<br />
- </indent>
+ <highlight language="config">
+ <Directory /www/docs/private>
+ AuthName "Private"
+ AuthType Basic
+ AuthBasicProvider dbm
+ AuthDBMUserFile /www/passwords/passwd.dbm
+ Require valid-user
</Directory>
- </example>
+ </highlight>
<p>Other options are available. Consult the
<module>mod_authn_dbm</module> documentation for more details.</p>
scheme that meets your needs. In the following example, both the
file and LDAP based authentication providers are being used.</p>
- <example>
- <Directory /www/docs/private><br />
- <indent>
- AuthName "Private"<br />
- AuthType Basic<br />
- AuthBasicProvider file ldap<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- AuthLDAPURL ldap://ldaphost/o=yourorg<br />
- Require valid-user<br />
- </indent>
+ <highlight language="config">
+ <Directory /www/docs/private>
+ AuthName "Private"
+ AuthType Basic
+ AuthBasicProvider file ldap
+ AuthUserFile /usr/local/apache/passwd/passwords
+ AuthLDAPURL ldap://ldaphost/o=yourorg
+ Require valid-user
</Directory>
- </example>
+ </highlight>
<p>In this example the file provider will attempt to authenticate
the user first. If it is unable to authenticate the user, the LDAP
authorization methods can also be used. In this example both file group
authorization as well as LDAP group authorization is being used.</p>
- <example>
- <Directory /www/docs/private><br />
- <indent>
- AuthName "Private"<br />
- AuthType Basic<br />
- AuthBasicProvider file<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- AuthLDAPURL ldap://ldaphost/o=yourorg
- AuthGroupFile /usr/local/apache/passwd/groups<br />
- Require group GroupName<br />
- Require ldap-group cn=mygroup,o=yourorg<br />
- </indent>
+ <highlight language="config">
+ <Directory /www/docs/private>
+ AuthName "Private"
+ AuthType Basic
+ AuthBasicProvider file
+ AuthUserFile /usr/local/apache/passwd/passwords
+ AuthLDAPURL ldap://ldaphost/o=yourorg
+ AuthGroupFile /usr/local/apache/passwd/groups
+ Require group GroupName
+ Require ldap-group cn=mygroup,o=yourorg
</Directory>
- </example>
+ </highlight>
<p>To take authorization a little further, authorization container
directives such as
that will be called during the authorization stage of the request
processing. For example:</p>
- <example>
+ <highlight language="config">
Require ip <var>address</var>
- </example>
+ </highlight>
<p>where <var>address</var> is an IP address (or a partial IP
address) or:</p>
- <example>
+ <highlight language="config">
Require host <var>domain_name</var>
- </example>
+ </highlight>
<p>where <var>domain_name</var> is a fully qualified domain name
(or a partial domain name); you may provide multiple addresses or
board, and you want to keep them out, you could do the
following:</p>
- <example>
+ <highlight language="config">
<RequireAll>
- <indent>
- Require all granted<br/>
+ Require all granted
Require not ip 10.252.46.165
- </indent>
</RequireAll>
- </example>
+ </highlight>
<p>Visitors coming from that address will not be able to see
the content covered by this directive. If, instead, you have a
machine name, rather than an IP address, you can use that.</p>
- <example>
+ <highlight language="config">
<RequireAll>
- <indent>
- Require all granted<br/>
+ Require all granted
Require not host <var>host.example.com</var>
- </indent>
</RequireAll>
- </example>
+ </highlight>
<p>And, if you'd like to block access from an entire domain,
you can specify just part of an address or domain name:</p>
- <example>
- <RequireAll>
- <indent>
- Require all granted<br/>
- <RequireNone>
- <indent>
- Require ip 192.168.205<br />
- Require host phishers.example.com moreidiots.example<br />
- Require host ke
- </indent>
- </RequireNone>
- </indent>
- </RequireAll>
- </example>
+ <highlight language="config">
+ <RequireAll>
+ Require all granted
+ <RequireNone>
+ Require ip 192.168.205
+ Require host phishers.example.com moreidiots.example
+ Require host ke
+ </RequireNone>
+ </RequireAll>
+ </highlight>
<p>The above example uses the <directive module="mod_authz_core"
type="section">RequireNone</directive> directive
<a href="../ja/howto/cgi.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="../ko/howto/cgi.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
</div>
+<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
+ anglaise pour les changements récents.</div>
</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#intro">Introduction</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#configuring">Configurer Apache pour autoriser CGI</a></li>
prevent script execution while allowing anything else to be set in
<code>.htaccess</code> you can use:</p>
- <div class="example"><p><code>
-<Directory /www/htdocs><br />
-<span class="indent">
-Allowoverride All<br />
-</span>
-</Directory><br />
-<br />
-<Location /><br />
-<span class="indent">
-Options +IncludesNoExec -ExecCGI<br />
-</span>
+ <pre class="prettyprint lang-config">
+<Directory /www/htdocs>
+ Allowoverride All
+</Directory>
+
+<Location />
+ Options +IncludesNoExec -ExecCGI<br />
</Location>
- </code></p></div>
+ </pre>
+
<div class="note">This example assumes that your <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> is <code>/www/htdocs</code>.</div>
<p><code>.htaccess</code> file contents:</p>
- <div class="example"><p><code>
- AuthType Basic<br />
- AuthName "Password Required"<br />
- AuthUserFile /www/passwords/password.file<br />
- AuthGroupFile /www/passwords/group.file<br />
+ <pre class="prettyprint lang-config">
+ AuthType Basic
+ AuthName "Password Required"
+ AuthUserFile /www/passwords/password.file
+ AuthGroupFile /www/passwords/group.file
Require Group admins
- </code></p></div>
+ </pre>
+
<p>Note that <code>AllowOverride AuthConfig</code> must be in effect
for these directives to have any effect.</p>
the following configuration directives, placed in a
<code>.htaccess</code> file in the desired directory:</p>
- <div class="example"><p><code>
- Options +Includes<br />
- AddType text/html shtml<br />
+ <pre class="prettyprint lang-config">
+ Options +Includes
+ AddType text/html shtml
AddHandler server-parsed shtml
- </code></p></div>
+ </pre>
+
<p>Note that <code>AllowOverride Options</code> and <code>AllowOverride
FileInfo</code> must both be in effect for these directives to have any
the execution of CGI programs in a particular directory. This may be
implemented with the following configuration:</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
Options +ExecCGI<br />
AddHandler cgi-script cgi pl
- </code></p></div>
+ </pre>
+
<p>Alternately, if you wish to have all files in the given directory be
considered to be CGI programs, this may be done with the following
configuration:</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
Options +ExecCGI<br />
SetHandler cgi-script
- </code></p></div>
+ </pre>
+
<p>Note that <code>AllowOverride Options</code> and <code>AllowOverride
FileInfo</code> must both be in effect for these directives to have any
prevent script execution while allowing anything else to be set in
<code>.htaccess</code> you can use:</p>
- <example>
-<Directory /www/htdocs><br />
-<indent>
-Allowoverride All<br />
-</indent>
-</Directory><br />
-<br />
-<Location /><br />
-<indent>
-Options +IncludesNoExec -ExecCGI<br />
-</indent>
+ <highlight language="config">
+<Directory /www/htdocs>
+ Allowoverride All
+</Directory>
+
+<Location />
+ Options +IncludesNoExec -ExecCGI<br />
</Location>
- </example>
+ </highlight>
<note>This example assumes that your <directive
module="core">DocumentRoot</directive> is <code>/www/htdocs</code>.</note>
<p><code>.htaccess</code> file contents:</p>
- <example>
- AuthType Basic<br />
- AuthName "Password Required"<br />
- AuthUserFile /www/passwords/password.file<br />
- AuthGroupFile /www/passwords/group.file<br />
+ <highlight language="config">
+ AuthType Basic
+ AuthName "Password Required"
+ AuthUserFile /www/passwords/password.file
+ AuthGroupFile /www/passwords/group.file
Require Group admins
- </example>
+ </highlight>
<p>Note that <code>AllowOverride AuthConfig</code> must be in effect
for these directives to have any effect.</p>
the following configuration directives, placed in a
<code>.htaccess</code> file in the desired directory:</p>
- <example>
- Options +Includes<br />
- AddType text/html shtml<br />
+ <highlight language="config">
+ Options +Includes
+ AddType text/html shtml
AddHandler server-parsed shtml
- </example>
+ </highlight>
<p>Note that <code>AllowOverride Options</code> and <code>AllowOverride
FileInfo</code> must both be in effect for these directives to have any
the execution of CGI programs in a particular directory. This may be
implemented with the following configuration:</p>
- <example>
+ <highlight language="config">
Options +ExecCGI<br />
AddHandler cgi-script cgi pl
- </example>
+ </highlight>
<p>Alternately, if you wish to have all files in the given directory be
considered to be CGI programs, this may be done with the following
configuration:</p>
- <example>
+ <highlight language="config">
Options +ExecCGI<br />
SetHandler cgi-script
- </example>
+ </highlight>
<p>Note that <code>AllowOverride Options</code> and <code>AllowOverride
FileInfo</code> must both be in effect for these directives to have any
constructed using that path, plus the username specified. Given this
configuration:</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
UserDir /var/html
- </code></p></div>
+ </pre>
+
<p>the URL <code>http://example.com/~rbowen/file.html</code> will be
translated to the file path <code>/var/html/rbowen/file.html</code></p>
in which the asterisk is replaced with the username. Given this
configuration:</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
UserDir /var/www/*/docs
- </code></p></div>
+ </pre>
+
<p>the URL <code>http://example.com/~rbowen/file.html</code> will be
translated to the file path
<p>The <code class="directive"><a href="../mod/mod_userdir.html#userdir">UserDir</a></code> directive can be
used to redirect user directory requests to external URLs.</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
UserDir http://example.org/users/*/
- </code></p></div>
+ </pre>
+
<p>The above example will redirect a request for
<code>http://example.com/~bob/abc.html</code> to
<p>Using the syntax shown in the UserDir documentation, you can restrict
what users are permitted to use this functionality:</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
UserDir disabled root jro fish
- </code></p></div>
+ </pre>
+
<p>The configuration above will enable the feature for all users
except for those listed in the <code>disabled</code> statement.
You can, likewise, disable the feature for all but a few users by
using a configuration like the following:</p>
- <div class="example"><p><code>
+ <pre class="prettyprint lang-config">
UserDir disabled<br />
UserDir enabled rbowen krietz
- </code></p></div>
+ </pre>
+
<p>See <code class="directive"><a href="../mod/mod_userdir.html#userdir">UserDir</a></code>
documentation for additional examples.</p>
directive to make a particular subdirectory of a user's home directory
cgi-enabled.</p>
- <div class="example"><p><code>
- <Directory /home/*/public_html/cgi-bin/><br />
- Options ExecCGI<br />
- SetHandler cgi-script<br />
+ <pre class="prettyprint lang-config">
+ <Directory /home/*/public_html/cgi-bin/>
+ Options ExecCGI
+ SetHandler cgi-script
</Directory>
- </code></p></div>
+ </pre>
+
<p>Then, presuming that <code>UserDir</code> is set to
<code>public_html</code>, a cgi program <code>example.cgi</code>
constructed using that path, plus the username specified. Given this
configuration:</p>
- <example>
+ <highlight language="config">
UserDir /var/html
- </example>
+ </highlight>
<p>the URL <code>http://example.com/~rbowen/file.html</code> will be
translated to the file path <code>/var/html/rbowen/file.html</code></p>
in which the asterisk is replaced with the username. Given this
configuration:</p>
- <example>
+ <highlight language="config">
UserDir /var/www/*/docs
- </example>
+ </highlight>
<p>the URL <code>http://example.com/~rbowen/file.html</code> will be
translated to the file path
<p>The <directive module="mod_userdir">UserDir</directive> directive can be
used to redirect user directory requests to external URLs.</p>
- <example>
+ <highlight language="config">
UserDir http://example.org/users/*/
- </example>
+ </highlight>
<p>The above example will redirect a request for
<code>http://example.com/~bob/abc.html</code> to
<p>Using the syntax shown in the UserDir documentation, you can restrict
what users are permitted to use this functionality:</p>
- <example>
+ <highlight language="config">
UserDir disabled root jro fish
- </example>
+ </highlight>
<p>The configuration above will enable the feature for all users
except for those listed in the <code>disabled</code> statement.
You can, likewise, disable the feature for all but a few users by
using a configuration like the following:</p>
- <example>
+ <highlight language="config">
UserDir disabled<br />
UserDir enabled rbowen krietz
- </example>
+ </highlight>
<p>See <directive module="mod_userdir">UserDir</directive>
documentation for additional examples.</p>
directive to make a particular subdirectory of a user's home directory
cgi-enabled.</p>
- <example>
- <Directory /home/*/public_html/cgi-bin/><br />
- Options ExecCGI<br />
- SetHandler cgi-script<br />
+ <highlight language="config">
+ <Directory /home/*/public_html/cgi-bin/>
+ Options ExecCGI
+ SetHandler cgi-script
</Directory>
- </example>
+ </highlight>
<p>Then, presuming that <code>UserDir</code> is set to
<code>public_html</code>, a cgi program <code>example.cgi</code>
do this. You can tell Apache to parse any file with a
particular file extension, such as <code>.shtml</code>, with
the following directives:</p>
-<div class="example"><p><code>
+<pre class="prettyprint lang-config">
AddType text/html .shtml<br />
AddOutputFilter INCLUDES .shtml
-</code></p></div>
+</pre>
+
<p>One disadvantage to this approach is that if you wanted to
add SSI directives to an existing page, you would have to
directives would be executed.</p>
<p>The other method is to use the <code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code> directive:</p>
-<div class="example"><p><code>
+<pre class="prettyprint lang-config">
XBitHack on
-</code></p></div>
+</pre>
+
<p><code class="directive"><a href="../mod/mod_include.html#xbithack">XBitHack</a></code>
tells Apache to parse files for SSI
<p>In your configuration file, you could put the following
line:</p>
-<div class="example"><p><code>
+<pre class="prettyprint lang-config">
BrowserMatchNoCase macintosh Mac<br />
BrowserMatchNoCase MSIE InternetExplorer
-</code></p></div>
+</pre>
+
<p>This will set environment variables ``Mac'' and
``InternetExplorer'' to true, if the client is running Internet
do this. You can tell Apache to parse any file with a
particular file extension, such as <code>.shtml</code>, with
the following directives:</p>
-<example>
+<highlight language="config">
AddType text/html .shtml<br />
AddOutputFilter INCLUDES .shtml
-</example>
+</highlight>
<p>One disadvantage to this approach is that if you wanted to
add SSI directives to an existing page, you would have to
<p>The other method is to use the <directive
module="mod_include">XBitHack</directive> directive:</p>
-<example>
+<highlight language="config">
XBitHack on
-</example>
+</highlight>
<p><directive module="mod_include">XBitHack</directive>
tells Apache to parse files for SSI
<p>In your configuration file, you could put the following
line:</p>
-<example>
+<highlight language="config">
BrowserMatchNoCase macintosh Mac<br />
BrowserMatchNoCase MSIE InternetExplorer
-</example>
+</highlight>
<p>This will set environment variables ``Mac'' and
``InternetExplorer'' to true, if the client is running Internet