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.
  • 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
    Commented Sep 11, 2011 at 3:31

1 Answer 1


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.

  • 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
    Commented Sep 26, 2011 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. Commented Sep 26, 2011 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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