I have a Virtualhost made this way:

<VirtualHost *:80>
        Servername www.website.com
        DocumentRoot /path/to/application-1.2.1/client/app/
        ErrorLog /var/log/apache2/logs/application.log

Where application is the application name that changes everytime we deploy a new version, so for example next DocumentRoot would be:

DocumentRoot /path/to/application-1.2.2/client/app/

Is it possible to make a virtualhost with a wildcard or something like:

DocumentRoot /path/to/application-*/client/app/

So that I don't have to change the virtualhost everytime I deploy a new version of the application?

1 Answer 1


No, you can't have a wildcard there.

Instead, use symlinks:

ln -s /path/to/application-1.2.2/client/app /path/to/application/client/app

and have the config read

<VirtualHost *:80>
        Servername www.website.com
        DocumentRoot /path/to/application/client/app/
        ErrorLog /var/log/apache2/logs/application.log

This has the added bonus that you can keep the old version around for a fast rollback when needed.

Depending on your main configuration, you may need to add

    <Directory /path/to/>
        Options +FollowSymlinks

to your config, as well.

  • I'm not sure if it is actually required for a DocumentRoot but most default configurations have the following of symbolic links disabled and you might need a <Directory /path/to/> Options +FollowSymlinks </Directory> in the virtualhost entry.
    – HBruijn
    Apr 10, 2015 at 14:07
  • @HBruijn Good catch, I added this to my response.
    – Jenny D
    Apr 10, 2015 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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