I'm trying to setup an alternate modules and themes directory which I can track with GIT separate from the contributed modules directory.

Following this question, I created a directory in the following structure:


mymodule was working just fine when it was based in sites/all/modules/custom/mymodule but once moved it was no longer listing on the modules page, nor the features page - mymodule is features generated.

I attempted the following directory structure:


But it's still not working.

Can anyone please help me with this problem?

  • Did you empty the cache after you moved your module? – Cyclonecode Aug 31 '15 at 13:44
  • Yes, flushed caches multiple times – sisko Aug 31 '15 at 14:10
  • So is your directory structure this: /var/www/Mysite/sites/samplesite/modules/mymodule or this: /var/www/samplesite-sites/samplesite/modules/mymodule ? I assume the former but your question makes it look unclear. – rooby Sep 1 '15 at 0:04

Putting modules in sites/samplesite/modules/mymodule is specifically for a multi-site setup.

Drupal won't just load all modules in all sites directories all the time, it will only load modules in the samplesite directory if you are hitting the samplesite domain (or you have an entry in the sites/sites.php file to tell Drupal which domains map to samplesite.

The other option from the page you link to is to make a directory in sites/all/modules that is a symlink to your custom module directory. Then (assuming you're using Apache), make sure your server is configured to enable the FollowSymLinks option.

There are also a couple of other options:

  • Add a directory for your modules, eg. sites/all/modules/samplesite or whatever is logical to call it. Exclude that directory in your main .gitignore file. make that new directory a clone of your other modules repository. Alternatively you could not have the sub directory and have separate repositories for each module.
  • Using a similar directory structure as above, use git subtree to have a repository in a repository (or many individual module repositories if that is your requirement). This seems like a decent post to give you more information on git subtree: http://getlevelten.com/blog/tom-mccracken/smarter-drupal-projects-projects-management-git-subtree

Either method may be preferable depending on your situation however I would probably recommend the subtree method over the completely separate repositories. It would be easier to manage things like deployments, since with the subtree method the main repo still contains everything, even though the source repos are different.

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.