1

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?

Jeroen Ooms
  • 2,239
  • 8
  • 34
  • 51

1 Answers1

2

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?

quanta
  • 51,413
  • 19
  • 159
  • 217