You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by John Passaniti <jp...@rochester.rr.com> on 2002/03/25 14:28:39 UTC
Support For Searching Multiple User Directories
I've done my best by carefully reading the Apache documentation and trying
various things, but I just can't figure out a solution to the following
problem. On the server I'm on, I don't have access to compile modules, so
I'm probably looking for a mod_rewrite solution.
In the document root for my site, I have some directories:
/home/httpd/html/john
/home/httpd/html/paul
I can get to these with the obvious URLs:
http://mysite/john
http://mysite/paul
I also have users on my server, each with their own directories:
/home/george/public_html
/home/ringo/public_html
I can get to these with these expected URLs:
http://mysite/~george
http://mysite/~ringo
My server has the property that no user has the same name as a directory in
the document root for my site. So what I would like to do is flatten the
URL address space so that these work:
http://mysite/george
http://mysite/ringo
That is, I want to be able to remove the tilde from the URL.
I found an example that is kind of like what I want in
http://httpd.apache.org/docs/misc/rewriteguide.html ("Search pages in more
than one directory"), but the twist here is that I can't just append
%{REQUEST_FILENAME} to two different directory paths. It works for the
document root, but how do I handle the user directories? Unlike the
document root, there is the "public_html" directory between the user name
and the user's document root. I need some way to break up the incoming URL
into a user name and the document root. I understand regular expressions
and how to construct this:
^/([^/]+)(.*)
$1 = user name
$2 = rest of URL
But I don't understand the appropriate RewriteCond/RewriteRule incantation
to use this.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org