Hello,

I've got a client running Drupal 6 and we've got one site set up successfully and people can login without problems. I'm attempting to add another site using this method and the site works fine, except for the fact that no one can log in. I can login as the administrator account only if I use the lost password form, send the link to my email, click it, and reset my password from there. However, if I then logout and try to log back in again I get "unrecognized username or password." Likewise, if I try and login with another account on a different browser I get the same error.

We're running this multisite as a single codebase with different databases and different domain names. In .htaccess I'm doing the following to redirect domain.com to www.domain.com:

RewriteCond %{HTTP_HOST} primarysite\.com$ [NC]
RewriteCond %{HTTP_HOST} !^www\.primarysite\.com$ [NC]
RewriteRule ^(.*)$ http://www.primarysite.com/$1 [L,R=301]

RewriteCond %{HTTP_HOST} secondarysite\.com$ [NC]
RewriteCond %{HTTP_HOST} !^www\.secondarysite\.com$ [NC]
RewriteRule ^(.*)$ http://www.secondarysite.com/$1 [L,R=301]

In settings.php I've tried quite a few different things including leaving both $base_url and $cookie_domain commented and I've also tried setting them both to secondarysite.com, www.secondarysite.com, as well as .secondarysite.com for $cookie_domain per the suggestion here, but none of it works.

Comments

michaelraasch’s picture

Hi. Is there any particular reason that you use .htaccess?
I also look after a multi-site setup with one codebase and multiple DBs, however with the only difference that we use subdomains. We have Apache handling this with sites-available and sites-enable. We have one file in sites-available/sites-enable for each subdomain e.g. for site1.mydomain.com (and other ones like site2.mydomain.com .... )

<VirtualHost *:80>
        ServerAdmin webmaster@mydomain.com
        DocumentRoot /data/webroot/production.mydomain.com/htdocs
        ServerName site1.mydomain.com
        ErrorLog /data/webroot/production.mydomain.com/logs/error_site1_log
        TransferLog /data/webroot/production.mydomain.com/logs/access_site1_log

        <Directory "/data/webroot/production.mydomain.com/htdocs">
                AllowOverride FileInfo Limit Options Indexes
                RewriteEngine on
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
        </Directory>
</VirtualHost>

And the corresponding Drupal settings.php are:
/sites/site1.mydomain.com/settings.php
/sites/site2.mydomain.com/settings.php

This should also work with different domains I reckon.

Saoirse1916’s picture

In this setup we've got a VPS that has one site created in cPanel with other parked domains. We're using this method to create the multisite install so sites-available and sites-enabled wouldn't really apply in our case. We use .htaccess to force traffic from siteone.com to www.siteone.com (and likewise with site two).

I can tell that my specific settings.php files (sites/siteone.com/settings.php and sites/sitetwo.com/settings.php) are working properly because they are pointing to different databases and the sites do come up as expected. We just can't login to site two without using the password reset email.

mdupont’s picture

Category: bug » support
Priority: Major » Normal

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.