[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 866
  • Last Modified:

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 ?
0
Xyptilon2
Asked:
Xyptilon2
  • 3
1 Solution
 
mrielfCommented:
Use AliasMatch this:

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

It works...
0
 
mrielfCommented:
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...


 
0
 
Xyptilon2Author Commented:
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.
0
 
mrielfCommented:
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

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now