In the past we've used name-based virtual hosting in Apache. We recently converted websites to SSL and had to go the ip-based route. As a result, we currently have an instance that is set up as follows:

  • www.domain.com using port 80
  • dev.domain.com using port 8080

Both use the same IP. Is this scenario possible using Drupal multi-site functionality? While we find that dev.domain.com works and reads the correct "dev" database (using the dev settings), it reads theme files from the "www" site instead which is not what we want.

Is the culprit the dev's htaccess file? Apache is listening on 8080 and does use the proper DB settings, but just not the correct theme files. One other note: browsing dev.domain.com:8080 gives an error: "The page isn't redirecting properly". Should we just purchase a new IP address for the dev website, or would this still not help?

Any advice would be appreciated. Thanks.


Have you tried specifying a port with your ServerName directive for each VirtualHost stanza?

  • I have not as I hadn't seen that in the examples Apache provides. I suppose it couldn't hurt to try. – MattB Dec 22 '10 at 16:37

There might be a better solution if you want to pay for it.. Buy a wild card cert for *.domain.com

I think the prices are around 150-200 for a year.. That will clear up your issues..

If you don't want to do that.. you can edit your htaccess to be more generic to handle ports

  • Thanks. I don't believe a wildcard cert is an option at the moment. So you believe it's an .htaccess issue? – MattB Dec 22 '10 at 15:46

Turns out dev.domain.com was only looking at www.domain.com all along and reading the correct DB config file from there rather than dev.domain.com. This ended up being an issue of .conf file order where dev.domain.com was being read after www.domain.com due to .conf naming scheme. I renamed domain1-dev.conf to dev-domain1.com and all works great now as dev.domain.com is being read prior to www.domain.com which is like a catchall.

This had nothing to do with ports or anything outside of Apache's VirtualHost settings. Here's what I used to help determine order read:

$PATH_TO_APACHE_DIR/bin/httpd -S

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.