Hi,

Is it possible to let Drupal redirect to a subdirectory of a site directory, such that the settings.php/modules/themes/files are used in there?

drupal51
   sites
      site.example.com
          ...
          ...
          www                   <-- let Drupal look in here
             settings.php
             themes
             files
             modules
          ...

If this is not possible without hacking it, I should look for something different.

Thanks in advance,

Bram Schoenmakers

Comments

cog.rusty’s picture

Depends on what you want to do.

For uploading files, Drupal is aware of the "files" directory that you have specified in the settings. For viewing content, it is just what path your browser sees on the page you are looking at.

How exactly do you want to use those files? In a theme? In the content?

In code (e.g. in theme template files) you can use something like

<?php print base_path() . path_to_theme(); ?>

bram85’s picture

The idea is to chroot a user in its site directory when logging in with SFTP. This involves creating some /bin , /lib, /usr folders. That is not the problem, I have already set up something like that for non Drupal sites. Now I want the user to give write access to his 'home' directory (/www) and that Drupal uses that instead. Of course I can lock him up in sites/foo.example.com , but then I bother the user with folders he does not care about (and Drupal will not as well).

But while writing this I think I can symlink some files:

drupal51
   sites
      foo.example.com
         bin
         files --> www/files
         lib
         modules --> www/modules
         settings.php --> www/settings.php
         themes --> www/themes
         www
            files
            modules
            themes
            settings.php

Bram Schoenmakers

cog.rusty’s picture

Oh, sure, symlinks is the way to do that. I was thinking that by "let Drupal redirect to a subdirectory of a site directory" you meant to do something from inside Drupal.