In the source to mod_userdir, the usage comments says that you may combine UserDir entries to allow alternates. The given example is: UserDir public_html /usr/web http://www.xyz.com/users which says to search for ~username/public_html then /usr/web/ username and finally do a redirect to http://www.xyz.com/users/username. However, this example does not work in Apache 2.0.36. Imagine that we have "real" users of aaa and bbb (that is, with a login/ homedir), a set of "fake" users yyy and zzz with only a directory under /usr/ web, and a set of redirected users mmm and nnn. Now, using the above configuration, point a browser to http://host/~aaa and ~bbb - it works. However ~yyy ~zzz ~mmm ~nnn do not work. If you swap /usr/web and public_html, now ~yyy and ~zzz work, yet ~mmm and ~nnn do not work. Thus, there is no way to make all three alternates work on the same system and no way to do preference of order of search either. The solution is to change the "return DECLINED" in the #if APR_HAS_USER section of mod_user to a "continue". The diff -u is: --- mod_userdir.c.orig Tue May 21 16:03:22 2002 +++ mod_userdir.c Tue May 21 16:03:50 2002 @@ -330,10 +330,10 @@ filename = apr_pstrcat(r->pool, homedir, "/", userdir, NULL); } else { - return DECLINED; + continue; } #else - return DECLINED; + continue; #endif } -----end-diff---- Currently, /usr/web or /web/*/html style UserDir entries will search for the exact file for the username+dir and if it is not found, it move on to the next entry on the UserDir line. However, for the "public_html" style UserDir entry, if we do not find ~username/public_html then we decline to process this request and do not go to the next entry on the UserDir line. So, end of request, 404. If we change the "return DECLINED" to "continue" as above, then we can move on to the next UserDir entry. Entries in the form of http:// are redirects and must come last. Apache does not know if the user exists on the remote machine, thus it must come last on the line. This fact should be mentioned in the docs and source. Yet, the ability to even use alternates in not mentioned in the docs, only in the source. This needs to be added too. I can write a paragraph if someone wants (oh, and while we're working on mod_userdir.c, around line 351, can we change the tabs to spaces? ;-)
Yes I have set UserDir to public_html but in order the access the users web site you must add a / at the end line ~user/ instead of just ~user Bug or my fault?
rea: Please don't modify someone else's bug unless you are sure you are adding useful information. The problem you are reporting has nothing to do with the original bug and is answered at http://httpd.apache.org/docs/misc/FAQ.html#set-servername
I have committed the patch below with a slight modification, along with some documentation. Thank you for the bug report, and thank you for using Apache 2.0.