Problem accessing second site when not using www in URL

Events happening in the community are now at Drupal community events on www.drupal.org.
Clark81's picture

I have installed Drupal 6.4 into the root directory on my GoDaddy shared hosting account and everything works great with my initial site. I installed a second site and everything also works great with the exception of when the "www" is omitted when typing in the URL. If I type www.secondsite.com everything works correctly but if I type in secondsite.com it sends me to my first site.

Through the GoDaddy management tools I have my second domain pointing to the root of the hosting account which I believe is the correct way to set up a multisite install. Does anybody know if there is a way to make the second site come up if a user doesn't type in 'www' first? Thanks

Comments

My guess is you either have

thomas23's picture

My guess is you either have GoDaddy configured wrong or your /sites folders are not correctly named.

The second domain should point to your Drupal root folder as well (file system folder, to be configured via GoDaddy, sometimes called VirtualHost or subdomain configuration); I'll call it /drupal. I'm just saying this explicitly because I'm not getting this 100% from what you wrote but think it's already the case. All your domains have to point to this file system directory, i.e. GoDaddy's web server has to look in that folder for drupals index.php. Remember that www.anydomain.com is actually a subdomain of anydomain.com eventhough most providers have this setup per default.

Drupal will "pass" the request through to /drupal/sites. So what is your folder tree there? You should have something like
/drupal/sites/firstsite.com
and
/drupal/sites/secondsite.com

(and not e.g. /drupal/sites/www.secondsite.com)

Hope this helped. Good luck. Cheers.

Hi, you may have found my

Clark81's picture

Hi, you may have found my problem. My directory structure looks like:

(host root)/sites/all

(host root)/sites/default (which is where my "firstsite.com" is installed and works fine with or without "www")

(host root)/sites/www.secondsite.com (where omitting the "www" results in landing on firstsite.com; although the URL still always shows "secondsite.com/whatever")

Can I just rename sites/www.secondsite.com to sites/secondsite.com or would that break some content that has already been loaded? If I have to re-install or re-do my content, should the second site work with both the "www" and without it?

Thank you for the help.

Yes, you can ;)

thomas23's picture

You can rename those directories. Which directory drupal "jumps into" depends on the url/domain name in your browser you call the site with. /sites/default is the one that is "hit" if nothing else matches.

Have a look in that settings.php file. In the comments there is q pretty good description of what's going on.

Cheers.

Another workaround

platypus media's picture

I'm not sure if you can do this with godaddy, but you can create a symlink for www.secondsite.com to point to your secondsite folder. That should work just as well.

Mike

Thanks for the multiple

Clark81's picture

Thanks for the multiple suggestions guys. I renamed the directory "www.secondsite.com" to "secondsite.com" and besides a minor config change (fixing the logo and favicon paths) everything works now with and without the "www".

Thanks again...

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week