1

I've just copied a multisite installation from a production server where everything is working fine. I think I've got a configuration issue in my hands because content is present so the databases are fine. Here's what's happening:

enter image description here

For each of the three sites, every page shows the same content (home page), no matter the URL. Navigate to mysite.com/user and same thing. Try mysite.com/?q=user then I see the login form and I log in. Then I am logged in and see the Admin menu across the top as expected, but still no matter what URL I go to I still see the home page. It's not a redirect, though -- the URL does change (eg. http://example.com/admin/content/node/overview). When I try eg. .../index.php?q=admin/content/node/overview then the page never loads.

Is this a mod_rewrite issue?? I can't figure out what's going on. But I feel like I am close to getting this working! Here is httpd.conf:

...
DocumentRoot "c:/wamp/www/drupal"
...
<Directory "c:/wamp/www/drupal">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
...

httpd-vhosts.conf:

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/drupal"
    ServerName site1.com
    ServerAlias www.site1.com
    ErrorLog "logs/drupal.site1.com.local-error.log"
    CustomLog "logs/drupal.site1.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/drupal"
    ServerName site2.com
    ServerAlias www.site2.com
    ErrorLog "logs/drupal.site2.local-error.log"
    CustomLog "logs/drupal.site2.local-access.log" common
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/drupal"
    ServerName site3.com
    ServerAlias www.site3.com
    ErrorLog "logs/drupal.site3.com.local-error.log"
    CustomLog "logs/drupal.site3.com.local-access.log" common
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "C:/wamp/www"
    ServerName localhost
    ServerAlias www.localhost.com
    ErrorLog "logs/drupal.localhost.local-error.log"
    CustomLog "logs/drupal.localhost.local-access.log" common
</VirtualHost>

.htaccess:

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment and adapt the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

  RewriteCond %{HTTP_HOST} ^([a-z.]+)?site1\.com$ [NC]
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteRule .? http://www.%site1.com%{REQUEST_URI} [R=301,L]

  RewriteCond %{HTTP_HOST} ^([a-z.]+)?site2\.com$ [NC]
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteRule .? http://www.%site2.com%{REQUEST_URI} [R=301,L]

  RewriteCond %{HTTP_HOST} ^([a-z.]+)?site3\.com$ [NC]
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteRule .? http://www.%site3.com%{REQUEST_URI} [R=301,L]

</IfModule>

Hosts file:

127.0.0.1 localhost
127.0.0.1 site1.com
127.0.0.1 site2.com
127.0.0.1 site3.com
127.0.0.1 www.site1.com
127.0.0.1 www.site2.com
127.0.0.1 www.site3.com

How do I fix this?

  • Where is that .htaccess file you show above? If that's the Drupal .htaccess, try reverting it back to default. You should be able to accommodate multiple sites via virtual directories or a multisite setup - it shouldn't be done in htaccess. – Patrick Ryan Feb 16 '16 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.