Before answering, it's helpful to have a little background about how Drupal finds modules. Drupal uses a list of suggestions from the Drupal root to figure out where to find modules. In order of priority:
If Drupal doesn't find a module in (1), it checks (2). If it's not there, it checks (3), and so on.
For (1), if you're just using a basic, single-site install of Drupal,
- In Drupal 6,
$SITENAME is the host name of the site. If your site is located at
$SITENAME would be
- In Drupal 7,
$SITENAME is defined in
sites/sites.php. If you look at
example.sites.php, you can see how to define it. It's also important to note that any module listed there will only be usable for that specific sites, not all sites.
In (2), any module found there will be usable on any site in the Drupal installation. It will also be left untouched when you upgrade the core installation. This is, of course, the recommended place to put modules and likely all documentation you've read have told you to put your modules here.
(3) is used for installation profiles that require a specific module. Installation profiles are essentially a way to define a custom initial state for a Drupal site. For example, Drupal comes with two installation profiles built in: Standard, which includes most-used features, and Minimal, which only includes the bare minimum needed for a Drupal site to function.
(4) is used by Drupal core. While you can technically add modules here and they will be available for all sites, you shouldn't. Seriously. The
modules folder is touched when Drupal core is updated, and will cause problems down the line if you're sticking modules you need for your site to function there.
Now that the background is out of the way, you can use file system tricks to have your modules housed outside of where Drupal looks.
For example, you could set up a symbolic link from
sites/all/modules to another directory outside of the Drupal installation:
- In Unix/Linux/BSD-based systems:
ln -s /path/to/modules/folder /path/to/drupal/sites/all/modules
- On Windows Vista/Server 2008/7 and higher:
mklink C:\path\to\drupal\sites\all\modules C:\path\to\custom\modules\folder
As far as I'm aware, there's not much you can do in earlier versions of Windows that don't have mklink.