In Apache2 I would like to dynamically Alias urls like this:

Alias /foo /etc/myapp/foo/www

Alias /bar /etc/myapp/bar/www

Alias /noob /etc/myapp/noob/www

and so forth, where /xxx is any existing directory under /etc/myapp that contains a subdirectory 'www'. Is this possible in Apache2?

link|improve this question

feedback

1 Answer

up vote 2 down vote accepted

Depends on what you want, you can do it with mass virtual hosting, mod_rewrite, or simple shell script:

for d in `ls -l /etc/myapp | grep '^d' | awk '{ print $9 }'`; do 
    if [ `ls -l /etc/myapp/"$d" | grep '^d' | grep -c www` -eq 1 ]; then 
        echo "Alias /$d /etc/myapp/$d/www" >> /path/to/httpd.conf
    fi 
done

Could you please explain your situation a little more?

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.