Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

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 Drupal site running on Apache using the following vhosts file:

<VirtualHost xx.xx.xx.xx:80>
        ServerName              bananas.net
        ServerAlias             www.bananas.net
        DocumentRoot            /var/www/drupal/
        RewriteEngine           On
        RewriteCond             %{HTTP_HOST} !=bananas.net [NC]
        RewriteRule             ^(.*)$ http://bananas.net$1 [L,R=301]

        <Directory              /var/www/bananas.net/>
                Options         -Indexes FollowSymlinks
                AllowOverride   All
                Order           allow,deny
                Allow           from all

        CustomLog               ${APACHE_LOG_DIR}/access.log combined
        ErrorLog                ${APACHE_LOG_DIR}/error.log

I set it up some time ago, so I am not sure what the <Directory /var/www/bananas.net/> directive was meant for. That directory is currently empty.

  1. With the vhosts file the way it is, does the Directory directive have any effect at all?
  2. I want to add some content which is separate from the Drupal site. How do I add sub-directories within /var/www/bananas.net/ which can be accessed alongside the Drupal site running at the root? As they have nothing to do with the Drupal site, I want to keep the files separate, but still using the same domain.
share|improve this question
I have been told that I am not setting the Options directive correctly, but I have not had time to go through my vhosts files yet. – paradroid Sep 11 '11 at 3:31
up vote 1 down vote accepted

If you are trying to get sub directories outside of the document root to appear as a part of the document root, you should use mod_alias:

Alias /subdirectory /path/to/real/subdirectory

So if you had the sub-directory 'peel' that you wanted to show up as 'http://www.bananas.net/peel' without putting it inside '/var/www/drupal', you would do:

Alias /peel /var/www/bananas.net/peel

You can do this either in the vhost file or, if you allow overrides in /var/www/drupal, using a .htaccess file.

share|improve this answer
Thanks. I had actually done that before fir things such as favicons before, duh. Do you know how to do the opposite (run a Drupal site in a subdirectory)? I have still not managed to achieve this. drupal.stackexchange.com/questions/10612/… – paradroid Sep 26 '11 at 3:43
Not sure I can help you with that at the moment. The guys over at ServerFault might be more in tune with what you're trying to do, since it's more an Apache thing than a Drupal thing. – Justin Pearce Sep 26 '11 at 13:13

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.