Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a web app ( that stores images in a sub-folder ( of the DocumentRoot (aka web root). I am rebuilding the app on a different domain ( and have created a sub-domain specifically for storing images ( While I am building, testing, and using the new app, I still need the old app to continue accessing that old image sub-folder. All of this is being done on the same server. I need the new sub-domain to have the same access to the images that are in the old sub-folder.

For this particular case, I do not have the option of changing the DocumentRoot directive. I do have access to Alias and Redirect.

Can I Alias the DocumentRoot of the vhost to the old sub-directory of another vhost (/var/www/vhost/

In other words, something like this in the vhost block:

`AliasMatch ^/(.*) /var/www/vhost/$1

share|improve this question
up vote 0 down vote accepted

You should be able to do that, but you need to add the trailing slash to the images directory before the $1. You also need to make sure that you've got the correct access rights to the images directory, both in the filesystem and in the apache config.

share|improve this answer
I was going by the example at which does not have a trailing slash. Apparently that slash was what I needed. Thanks. – SunSparc Jul 13 '12 at 19:48
The difference is that in the example there was also no slash before the capture. By putting it first, you removed it from the reference you captured - if you'd had the slash inside the capture it would also have worked. – Jenny D Jul 14 '12 at 20:38
Makes sense. Thank you. – SunSparc Jul 15 '12 at 18:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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