My favorites | Sign in
Project Logo
                
Search
for
Updated May 25, 2007 by schuyle...@gmail.com
CleanURLs  

NOTE: This Google-code site is now deprecated. The project now resides at: http://drupal.org/project/multisite_manager

How to get CLEAN URLS working with apache and multisite setup:

It's gross! I told you so!!!!!

<VirtualHost *:80>
  DocumentRoot /usr/local/share/sandboxes/common/drupal/drupal/
  # Welcome to the Ugliest Rewrite Rules Evar(tm)!
  # Here's the jist:
  # 1. AliasMatch will set the file context without passing a different URL to Drupal
  #    Therefore index.php must be matched outside of Rewrite rules
  # 2. Rewrite is used ONLY to forward URLs of the form /xxx -> index.php?q=/xxx
  #
  # If we took Rewrite rules outside of the Location contexts so its in per-server
  # processing, we might be able to simplify this.  We would need option 'PT' for
  # passthrough and then some AliasMatch record AFTER the rewrite rules.

  # If you figure it out, then go for it.  Otherwise, what ain't broken...
  AliasMatch ^/site/\w+/index.php /var/www/drupal/index.php
  AliasMatch ^/site/\w+/(modules|misc|files|themes|sites)/(.*)$ /var/www/drupal/$1/$2

  <Location />
    RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^var/www/drupal(.*)$ index.php?q=$1 [L,QSA]
  </Location>
 <Location /site>
    RewriteEngine on 
    RewriteCond %{REQUEST_URI} ^/site/
    RewriteCond %{REQUEST_URI} !index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^/var/www/drupal/site/(\w+)(/)?(.*)$ http://www.example.com/site/$1/index.php?q=$3 [L,QSA]
  </Location>
 
</VirtualHost>

Sign in to add a comment
Hosted by Google Code