Let Regular Web Sites Coexist with a CMS like Drupal
I have a server setup where I want Drupal (could be any other CMS, though) to be served from the document root. I.e., I don't want a URL like http://my.server/drupal/interesting-page, but instead I want http://my.server/interesting-page. This is easy to achieve in Apache2: I simply have to set the document root to the Drupal folder. Here is an example from an Apache2 configuration file:
  <VirtualHost *>
  ...
  DocumentRoot /var/www/drupal
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>
  <Directory /var/www/drupal>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all
  </Directory>
  ...
  </VirtualHost>
Another requirement I have is that certain folders should be served alongside Drupal. E.g., let's assume I have a folder called dumps, which I want to serve at http://my.server/dumps. Now, I could of course just put it into the drupal folder at /var/www/drupal/dumps. However, I would like the drupal folder to only contain drupal stuff. Otherwise things might get messy when I do updates, etc. This is where the Alias directive in Apache's mod_alias module comes in handy. I can put dumps at /var/www/dumps and then map requests to http://my.server/dumps to that folder. Here is what that looks like in my Virtual Host definition (including some settings for how to handle that folder):
Alias /dumps "/var/www/dumps" <Directory "/var/www/dumps"> Options Indexes MultiViews AllowOverride None Order deny,allow Allow from all </Directory>




0 Comments:
Post a Comment
<< Home