Solution multisite htaccess cleanURL

My solution to getting Clean URL working with my multisite setup drupal 4.7

I added Alias to my httpd.conf apache file:

<VirtualHost *:80>
    # Alias for all php drupal sites
    Alias /abc /var/www/html/drupal
    Alias /def /var/www/html/drupal
    Alias /xyz /var/www/html/drupal
</VirtualHost>

 

My setup has 4 sites /drupal, /abc, /def, /xyz all files are in the /drupal directory

  • url=/drupal (sites/default/)
  • url=/abc (sites/localhost.abc/)
  • url=/def (sites/localhost.def/)
  • url=/xyz (sites/localhost.xyz/)

 

In the /drupal/.htacess file. I added a RewriteCond %{REQUEST_URI} condition for
each site, and so have separate RewriteRule for each site.
No need for the RewriteBase directive, leave it commented out:

#RewriteBase /drupal  DO NOT NEED THIS, COMMENT OUT

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/drupal/(.*)$
RewriteRule ^(.*)$ /drupal/index.php?q=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/abc/(.*)$
RewriteRule ^(.*)$ /abc/index.php?q=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/def/(.*)$
RewriteRule ^(.*)$ /def/index.php?q=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/xyz/(.*)$
RewriteRule ^(.*)$ /xyz/index.php?q=$1 [L,QSA]

 

Note: each site has its own database aswell as files, modules and themes directories in the corresponding sites/localhost.site/ directory.

你可能感兴趣的:(Access)