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