0

I'm not sure is it about the server or Drupal. Anyway, my Drupal was installed inside the directory "/public_html" folder. We are pointing "mysiteA.com" and "mysiteB.com" into this directory.

Both urls look the same but only "mysiteB.com" is able to login. And "mysiteA.com" is showing "access denied" after submit the login form. The question is, Drupal is showing "mysiteB.com" domain inside the "configuration > Site information". Is there a way to change it to be "mysiteA.com" or both(not sure is it possible)?

0
4

Let's back up and debug this from the top:

Confirm that both sites actually point to the same Drupal installation.

  • Open up a terminal or command prompt. Ping mysitea.com and mysiteb.com. Confirm that the IP address is the same for both domains.
  • Create a dummy file test.html in the Drupal root. Confirm that you can access it from both mysitea.com and mysiteb.com.

Confirm both sites actually use the same database

  • Look in the sites directory. The only two directories should be "default" and "all". If you see mysitea.com or mysiteb.com, it's possible you are using different DBs.

Figure out what Drupal config is causing the error

  • Confirm that you don't have any domain-related modules installed (domain access).
  • See if clearing all cookies after switching to the second domain let's you log in. i.e., is the problem that you can't ever log in to one of the domains, or that you just can't log in to them one after another? This could be due to the cookie domain.

Try setting $cookie_domain in settings.php for each site.

EDIT: Now I see that you tagged your post "domain-access", so I'm assuming you are using that module. Why didn't you say that in your post? That's kind of a critical thing to know if your problem is related to accessing a site on two domains ;) I'm pretty sure it's just a misconfiguration or bad permissions related to Domain Access. Try disabling it and see if you can access both sites.

1
  • Thanks @danepowell. 1) yes, confirmed that both sites are pointed tot he same Drupal installation. 2) yes, confirmed both sites actually using the same database 3) yes, i didn’t install any domain-access
    – CocoSkin
    Apr 28 '14 at 12:44
1

It seem like something to do with Cookie domain like what @danepowell said above. So I added the following code. Now, it's working!

on file "sites/default/settings.php", I added

$cookie_domain = '.mysiteA.com';

then I copy the file "sites/default/settings.php" to "sites/mysiteB.com/settings.php", and change the cookie_domain to

$cookie_domain = '.mysiteB.com';

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.