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_userdir - 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.min.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.4</p> 20<img alt="" src="/images/feather.gif" /></div> 21<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div> 22<div id="path"> 23<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.4</a> > <a href="./">Modules</a></div> 24<div id="page-content"> 25<div id="preamble"><h1>Apache Module mod_userdir</h1> 26<div class="toplang"> 27<p><span>Available Languages: </span><a href="/en/mod/mod_userdir.html" title="English"> en </a> | 28<a href="/fr/mod/mod_userdir.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> | 29<a href="/ja/mod/mod_userdir.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | 30<a href="/ko/mod/mod_userdir.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | 31<a href="/tr/mod/mod_userdir.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p> 32</div> 33<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>User-specific directories</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>userdir_module</td></tr> 36<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_userdir.c</td></tr></table> 37<h3>Summary</h3> 38 39<p>This module allows user-specific directories to be accessed using the 40<code>http://example.com/~user/</code> syntax.</p> 41</div> 42<div id="quickview"><h3 class="directives">Directives</h3> 43<ul id="toc"> 44<li><img alt="" src="/images/down.gif" /> <a href="#userdir">UserDir</a></li> 45</ul> 46<h3>See also</h3> 47<ul class="seealso"> 48<li><a href="/urlmapping.html">Mapping URLs to the 49Filesystem</a></li> 50<li><a href="/howto/public_html.html">public_html 51tutorial</a></li> 52</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div> 53 54<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 55<div class="directive-section"><h2><a name="UserDir" id="UserDir">UserDir</a> <a name="userdir" id="userdir">Directive</a></h2> 56<table class="directive"> 57<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the user-specific directories</td></tr> 58<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UserDir <em>directory-filename</em> [<em>directory-filename</em>] ... 59</code></td></tr> 60<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr> 61<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr> 62<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_userdir</td></tr> 63</table> 64 65 <p>The <code class="directive">UserDir</code> directive sets the real 66 directory in a user's home directory to use when a request for a 67 document for a user is received. <em>Directory-filename</em> is 68 one of the following:</p> 69 70 <ul> 71 <li>The name of a directory or a pattern such as those shown 72 below.</li> 73 74 <li>The keyword <code>disabled</code>. This turns off 75 <em>all</em> username-to-directory translations except those 76 explicitly named with the <code>enabled</code> keyword (see 77 below).</li> 78 79 <li>The keyword <code>disabled</code> followed by a 80 space-delimited list of usernames. Usernames that appear in 81 such a list will <em>never</em> have directory translation 82 performed, even if they appear in an <code>enabled</code> 83 clause.</li> 84 85 <li>The keyword <code>enabled</code> followed by a 86 space-delimited list of usernames. These usernames will have 87 directory translation performed even if a global disable is 88 in effect, but not if they also appear in a 89 <code>disabled</code> clause.</li> 90 </ul> 91 92 <p>If neither the <code>enabled</code> nor the 93 <code>disabled</code> keywords appear in the 94 <code>Userdir</code> directive, the argument is treated as a 95 filename pattern, and is used to turn the name into a directory 96 specification. A request for 97 <code>http://www.example.com/~bob/one/two.html</code> will be 98 translated to:</p> 99 100 <table> 101 <tr><th>UserDir directive used</th> 102 <th>Translated path</th></tr> 103 <tr><td>UserDir public_html</td> 104 <td>~bob/public_html/one/two.html</td></tr> 105 <tr><td>UserDir /usr/web</td> 106 <td>/usr/web/bob/one/two.html</td></tr> 107 <tr><td>UserDir /home/*/www</td> 108 <td>/home/bob/www/one/two.html</td></tr> 109 </table> 110 111 <p>The following directives will send redirects to the client:</p> 112 113 <table> 114 <tr><th>UserDir directive used</th> 115 <th>Translated path</th></tr> 116 <tr><td>UserDir http://www.example.com/users</td> 117 <td>http://www.example.com/users/bob/one/two.html</td></tr> 118 <tr><td>UserDir http://www.example.com/*/usr</td> 119 <td>http://www.example.com/bob/usr/one/two.html</td></tr> 120 <tr><td>UserDir http://www.example.com/~*/</td> 121 <td>http://www.example.com/~bob/one/two.html</td></tr> 122 </table> 123 124 <div class="note"> 125 <strong>Be careful when using this directive; for instance, 126 <code>"UserDir ./"</code> would map <code>"/~root"</code> to 127 <code>"/"</code> - which is probably undesirable. It is strongly 128 recommended that your configuration include a "<code>UserDir 129 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 130 more information.</strong> 131 </div> 132 133 <p>Additional examples:</p> 134 135 <p>To allow a few users to have <code>UserDir</code> directories, but 136 not anyone else, use the following:</p> 137 138 <pre class="prettyprint lang-config">UserDir disabled 139UserDir enabled user1 user2 user3</pre> 140 141 142 <p>To allow most users to have <code>UserDir</code> directories, but 143 deny this to a few, use the following:</p> 144 145 <pre class="prettyprint lang-config">UserDir disabled user4 user5 user6</pre> 146 147 148 <p>It is also possible to specify alternative user directories. 149 If you use a command like:</p> 150 151 <pre class="prettyprint lang-config">UserDir public_html /usr/web http://www.example.com/</pre> 152 153 154 <p>With a request for 155 <code>http://www.example.com/~bob/one/two.html</code>, will try to 156 find the page at <code>~bob/public_html/one/two.html</code> first, then 157 <code>/usr/web/bob/one/two.html</code>, and finally it will send a 158 redirect to <code>http://www.example.com/bob/one/two.html</code>.</p> 159 160 <p>If you add a redirect, it must be the last alternative in the list. 161 Apache httpd cannot determine if the redirect succeeded or not, so if you have 162 the redirect earlier in the list, that will always be the alternative 163 that is used.</p> 164 165 <p>User directory substitution is not active by default in versions 166 2.1.4 and later. In earlier versions, <code>UserDir public_html</code> 167 was assumed if no <code class="directive"><a href="#userdir">UserDir</a></code> 168 directive was present.</p> 169 170 <div class="note"><h3>Merging details</h3> 171 <p> Lists of specific enabled and disabled users are replaced, not merged, 172 from global to virtual host scope</p></div> 173 174 175<h3>See also</h3> 176<ul> 177<li> 178 <a href="/howto/public_html.html">Per-user web directories tutorial</a> 179</li> 180</ul> 181</div> 182</div> 183<div class="bottomlang"> 184<p><span>Available Languages: </span><a href="/en/mod/mod_userdir.html" title="English"> en </a> | 185<a href="/fr/mod/mod_userdir.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> | 186<a href="/ja/mod/mod_userdir.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | 187<a href="/ko/mod/mod_userdir.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | 188<a href="/tr/mod/mod_userdir.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </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&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[//><!-- 191var comments_shortname = 'httpd'; 192var comments_identifier = 'http://httpd.apache.org/docs/2.4/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 2014 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/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[//><!-- 209if (typeof(prettyPrint) !== 'undefined') { 210 prettyPrint(); 211} 212//--><!]]></script> 213</body></html>