Link to home
Start Free TrialLog in
Avatar of Xyptilon2
Xyptilon2Flag for China

asked on

Userdir rewrite homedirectories

Good afternoon all,

Something is driving me crazy, i have a machine running Debian with Apache 1.3
I have bout 500 users on the machine, all being virtual domains.

Some domains are in

/home/~username and some are in
/home/groupname/~username

now i want the following to happen, when somebody types in the browser

http://ip.ip.ip.ip/~username    and the username exists in /home/username,
it should point to /home/~username/www (this works, both with the userdir module
or aliasmatch... however, the problem arrises when there's a situation where
a request is made for http://ip.ip.ip.ip/group/username, this is then being
rewritten or translated to /home/group/www/username, but it should be
/home/group/username/www...

it gets even more complicate if there are subdirectories in that homedirectory.

Now i can think of a theoretical solution, which is to recursively check if
a directory exists and perform a translation.. i know this is possible using
rewriterule and rewritecond (although not sure if it can be applid recursively)

is there anybody that knows a simpler solution or that can point me in the
direction of such ?
ASKER CERTIFIED SOLUTION
Avatar of mrielf
mrielf

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mrielf
mrielf

I hate those askers who don't react to solutions at least "good" or "it doesn't fit my needs"

My solution works, i checked it on my sytem...


 
Avatar of Xyptilon2

ASKER

It did not work, because the group name is variable now, i am using
regular expressions now and aliasmatch to redirect. it works most
of the time.

However, for the sake of friendlyness, i will award you the points.
There is no need to generalize.
If answer isn't good enough then please do some react next time...

If group is changing too, then you can use AliasMatch tis way:

AliasMatch ^/([^/]+)/([^/]+)/(.*) "/home/$1/$2/www/$3