Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Short introduction on how to share drupal with all users on a shared server (without having troubles with file-permissions).
Note: it is still possible to use the Multisite option of drupal.
example server's file-structure:
/path/to/phplibraries/drupal (chmod 644)
/home/
user1/ (example.com)
lib (symbolic link => /path/to/phplibraries/)
public_html/
main/
files/
includes (symbolic link => /home/user1/lib/drupal/includes)
misc (symbolic link => /home/user1/lib/drupal/misc)
modules (symbolic link => /home/user1/lib/drupal/modules)
profiles (symbolic link => /home/user1/lib/drupal/profiles)
sites/
all (symbolic link => /home/user1/lib/drupal/sites/all)
default (symbolic link => /home/user1/lib/drupal/sites/default)
example.com/
settings.php
themes (symbolic link => /home/user1/lib/drupal/themes)
.htaccess (copy from drupal/.htaccess)
cron.php (copy from drupal/cron.php)
index.php (copy from drupal/index.php)
install.php (copy from drupal/install.php)
robots.txt (copy from drupal/robots.txt)
update.php (copy from drupal/update.php)
xmlrpc.php (copy from drupal/xmlrpc.php)
.htaccess (1)
user2/ (example2.com)
(same as user1)
user3/ (example3.com)
(same as user1)
etc...
.htaccess (1)
this isn't necessary but it keeps public_hml/ clean when several sites are maintained by one user. When only one site is maintained the contents of the main/ directory could be moved to public_html/ itself
Options +FollowSymLinks
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*) main/$1 [L,QSA]
</IfModule>
Comments
this method works pretty
this method works pretty good, if properly configured.
i would also advise creating a library of modules, themes and external libraries (/libraries), inside the sites/all directory.
symlink that to the other sites.
Luís Pedro Algarvio
Site Reliability / DevOps Engineer.
Free and Open Source Software advocate.
Passionate about life and work.
lp.algarvio.org