]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_userdir.html.en
ef87bbed5d1fd83190d710d28ee72c281bd7aa24
[apache] / docs / manual / mod / mod_userdir.html.en
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 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
5 <!--
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7               This file is generated from xml source: DO NOT EDIT
8         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9       -->
10 <title>mod_userdir - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <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" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
15 </script>
16
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
18 <body>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.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>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.png" /></div>
23 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
24 <div id="path">
25 <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.5</a> &gt; <a href="./">Modules</a></div>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache Module mod_userdir</h1>
28 <div class="toplang">
29 <p><span>Available Languages: </span><a href="../en/mod/mod_userdir.html" title="English">&nbsp;en&nbsp;</a> |
30 <a href="../ja/mod/mod_userdir.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
31 <a href="../ko/mod/mod_userdir.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
32 <a href="../tr/mod/mod_userdir.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
33 </div>
34 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>User-specific directories</td></tr>
35 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
36 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>userdir_module</td></tr>
37 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_userdir.c</td></tr></table>
38 <h3>Summary</h3>
39
40 <p>This module allows user-specific directories to be accessed using the
41 <code>http://example.com/~user/</code> syntax.</p>
42 </div>
43 <div id="quickview"><h3 class="directives">Directives</h3>
44 <ul id="toc">
45 <li><img alt="" src="../images/down.gif" /> <a href="#userdir">UserDir</a></li>
46 </ul>
47 <h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&amp;list_id=144532&amp;product=Apache%20httpd-2&amp;query_format=specific&amp;order=changeddate%20DESC%2Cpriority%2Cbug_severity&amp;component=mod_userdir">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&amp;component=mod_userdir">Report a bug</a></li></ul><h3>See also</h3>
48 <ul class="seealso">
49 <li><a href="../urlmapping.html">Mapping URLs to the
50 Filesystem</a></li>
51 <li><a href="../howto/public_html.html">public_html
52 tutorial</a></li>
53 <li><a href="#comments_section">Comments</a></li></ul></div>
54
55 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
56 <div class="directive-section"><h2><a name="UserDir" id="UserDir">UserDir</a> <a name="userdir" id="userdir">Directive</a></h2>
57 <table class="directive">
58 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the user-specific directories</td></tr>
59 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UserDir <em>directory-filename</em> [<em>directory-filename</em>] ...
60 </code></td></tr>
61 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
62 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
63 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_userdir</td></tr>
64 </table>
65
66     <p>The <code class="directive">UserDir</code> directive sets the real
67     directory in a user's home directory to use when a request for a
68     document for a user is received. <em>Directory-filename</em> is
69     one of the following:</p>
70
71     <ul>
72       <li>The name of a directory or a pattern such as those shown
73       below.</li>
74
75       <li>The keyword <code>disabled</code>. This turns off
76       <em>all</em> username-to-directory translations except those
77       explicitly named with the <code>enabled</code> keyword (see
78       below).</li>
79
80       <li>The keyword <code>disabled</code> followed by a
81       space-delimited list of usernames. Usernames that appear in
82       such a list will <em>never</em> have directory translation
83       performed, even if they appear in an <code>enabled</code>
84       clause.</li>
85
86       <li>The keyword <code>enabled</code> followed by a
87       space-delimited list of usernames. These usernames will have
88       directory translation performed even if a global disable is
89       in effect, but not if they also appear in a
90       <code>disabled</code> clause.</li>
91     </ul>
92
93     <p>If neither the <code>enabled</code> nor the
94     <code>disabled</code> keywords appear in the
95     <code>Userdir</code> directive, the argument is treated as a
96     filename pattern, and is used to turn the name into a directory
97     specification. A request for
98     <code>http://www.example.com/~bob/one/two.html</code> will be
99     translated to:</p>
100
101     <table>
102       <tr><th>UserDir directive used</th>
103           <th>Translated path</th></tr>
104       <tr><td>UserDir public_html</td>
105           <td>~bob/public_html/one/two.html</td></tr>
106       <tr><td>UserDir /usr/web</td>
107           <td>/usr/web/bob/one/two.html</td></tr>
108       <tr><td>UserDir /home/*/www</td>
109           <td>/home/bob/www/one/two.html</td></tr>
110     </table>
111
112     <p>The following directives will send redirects to the client:</p>
113
114     <table>
115       <tr><th>UserDir directive used</th>
116           <th>Translated path</th></tr>
117       <tr><td>UserDir http://www.example.com/users</td>
118           <td>http://www.example.com/users/bob/one/two.html</td></tr>
119       <tr><td>UserDir http://www.example.com/*/usr</td>
120           <td>http://www.example.com/bob/usr/one/two.html</td></tr>
121       <tr><td>UserDir http://www.example.com/~*/</td>
122           <td>http://www.example.com/~bob/one/two.html</td></tr>
123     </table>
124
125     <div class="note">
126       <strong>Be careful when using this directive; for instance,
127       <code>"UserDir ./"</code> would map <code>"/~root"</code> to
128       <code>"/"</code> - which is probably undesirable. It is strongly
129       recommended that your configuration include a "<code>UserDir
130       disabled root</code>" declaration.  See also the <code class="directive"><a href="../mod/core.html#directory">Directory</a></code> directive and the <a href="../misc/security_tips.html">Security Tips</a> page for
131       more information.</strong>
132     </div>
133
134     <p>Additional examples:</p>
135
136     <p>To allow a few users to have <code>UserDir</code> directories, but
137     not anyone else, use the following:</p>
138
139     <pre class="prettyprint lang-config">UserDir disabled
140 UserDir enabled user1 user2 user3</pre>
141
142
143     <p>To allow most users to have <code>UserDir</code> directories, but
144     deny this to a few, use the following:</p>
145
146     <pre class="prettyprint lang-config">UserDir disabled user4 user5 user6</pre>
147
148
149     <p>It is also possible to specify alternative user directories.
150     If you use a command like:</p>
151
152     <pre class="prettyprint lang-config">UserDir "public_html" "/usr/web" "http://www.example.com/"</pre>
153
154
155     <p>With a request for
156     <code>http://www.example.com/~bob/one/two.html</code>, will try to
157     find the page at <code>~bob/public_html/one/two.html</code> first, then
158     <code>/usr/web/bob/one/two.html</code>, and finally it will send a
159     redirect to <code>http://www.example.com/bob/one/two.html</code>.</p>
160
161     <p>If you add a redirect, it must be the last alternative in the list.
162     Apache httpd cannot determine if the redirect succeeded or not, so if you have
163     the redirect earlier in the list, that will always be the alternative
164     that is used.</p>
165
166     <p>User directory substitution is not active by default in versions
167     2.1.4 and later.  In earlier versions, <code>UserDir public_html</code>
168     was assumed if no <code class="directive"><a href="#userdir">UserDir</a></code>
169     directive was present.</p>
170
171     <div class="note"><h3>Merging details</h3>
172     <p> Lists of specific enabled and disabled users are replaced, not merged,
173     from global to virtual host scope</p></div>
174
175
176 <h3>See also</h3>
177 <ul>
178 <li>
179   <a href="../howto/public_html.html">Per-user web directories tutorial</a>
180 </li>
181 </ul>
182 </div>
183 </div>
184 <div class="bottomlang">
185 <p><span>Available Languages: </span><a href="../en/mod/mod_userdir.html" title="English">&nbsp;en&nbsp;</a> |
186 <a href="../ja/mod/mod_userdir.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
187 <a href="../ko/mod/mod_userdir.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
188 <a href="../tr/mod/mod_userdir.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
189 </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>
190 <script type="text/javascript"><!--//--><![CDATA[//><!--
191 var comments_shortname = 'httpd';
192 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_userdir.html';
193 (function(w, d) {
194     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
195         d.write('<div id="comments_thread"><\/div>');
196         var s = d.createElement('script');
197         s.type = 'text/javascript';
198         s.async = true;
199         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
200         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
201     }
202     else {
203         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
204     }
205 })(window, document);
206 //--><!]]></script></div><div id="footer">
207 <p class="apache">Copyright 2016 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>
208 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.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[//><!--
209 if (typeof(prettyPrint) !== 'undefined') {
210     prettyPrint();
211 }
212 //--><!]]></script>
213 </body></html>