The Linux Page

Path versus website domain & path with Drupal

With Drupal, it is possible to have many sites defined in many different ways.

These are the things you can have in your URL that Drupal will understand and use to configure your site. The configuration file is called settings.php and will reside in a folder of which the name is determined using the URL used to access the site.

1. Fully qualified domain name

2. Port

3. Path withing the website

Sites are expected to be found under the 'sites' folder found in the same directory as the index.php file.

The port, when specified, is put at the start of the path for the test. So a URL such as http://www.m2osw.com:80 will be transformed into 80.www.m2osw.com.

The path is added at the end with periods as separators. Thus, in our previous example, http://www.m2osw.com:8080/test/this becomes 8080.www.m2osw.com.test.this.

The loop will then remove parts starting on the left side of the domain name, removing all the parts of the domain except the extension (i.e. .org, .com, etc.)

The path is appended to /sites/ and in there Drupal will find the settings.php of that site. This means within one domain, you can an infinity of websites, each can look different, each can use a different set of modules... Ah! That's where it becomes very interesting.

If you have areas where people cannot post comments, or interact in any way, then you could make those parts a separate site. Why? Because that way you may be able to use a lot less resources for that area. Of course, most people would like everyone to participate and post comments on their pages, but the reality is that some documents are better protected!

Hope this helps a few. And for more info, search the includes/bootstrap.inc for 8080. You'll then find the function that's describing the mechanism. And here is a copy anyway:

 * Example for a fictitious site installed at
 * http://www.drupal.org:8080/mysite/test/ the 'settings.php' is searched in
 * the following directories:
 *
 *  1. $confdir/8080.www.drupal.org.mysite.test
 *  2. $confdir/www.drupal.org.mysite.test
 *  3. $confdir/drupal.org.mysite.test
 *  4. $confdir/org.mysite.test
 *
 *  5. $confdir/8080.www.drupal.org.mysite
 *  6. $confdir/www.drupal.org.mysite
 *  7. $confdir/drupal.org.mysite
 *  8. $confdir/org.mysite
 *
 *  9. $confdir/8080.www.drupal.org
 * 10. $confdir/www.drupal.org
 * 11. $confdir/drupal.org
 * 12. $confdir/org
 *
 * 13. $confdir/default