Userdir rewrite homedirectories

Posted on 2004-11-04
Last Modified: 2012-06-22
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

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

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 ?
Question by:Xyptilon2
    LVL 5

    Accepted Solution

    Use AliasMatch this:

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

    It works...
    LVL 5

    Expert Comment

    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...

    LVL 13

    Author Comment

    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.
    LVL 5

    Expert Comment

    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


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now