
email at davebv
Oct 17, 2009, 4:43 AM
Post #1 of 2
(388 views)
Permalink
|
|
Subdomain module for drupal and rewrite rules.
|
|
Hello, I am trying to set up a module for drupal which requires rewrites and wildcard virtual hosts. I am not able to make it work, and I tried a few things. These are the instructions: 1. edit some files in drupal installation... (which I already done, and seems to be ok) 2. Enable wildcard in the dns host provider (already done) 3. Configure wildcard virtual hosts. Apache (with mod_rewrite): NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin webmaster [at] example DocumentRoot /var/www/html ServerName example.com ServerAlias *.example.com <Directory "/var/www/html"> AllowOverride All </Directory> </VirtualHost> Lighttpd: Edit your lighttpd.conf file, enable the evhost module, and append the following, modifying directories as appropriate: $HTTP["host"] =~ "([^.]+)\.([^.]+)$" { evhost.path-pattern = "/var/www/%2.%1/html/" } # Apply the following drupal rewrite rules to subdomain URLs # moving subdomain to the 1st argument in the path # e.g. bob.example.com news.mysite.net $HTTP["host"] =~ "^([^.]+)\.([^.]+)\.([^.]+)$" { url.rewrite-final = ( # More than one argument "^/([^.?]*)\?(.*)$" => "/index.php?q=_%1/$1&$2", # No arguments "^/([^.?]*)$" => "/index.php?q=_%1/$1", ) } What I did in cherokee was appart from having a drupal installation running: In the drupal virtual host, in hosts, added the wildcard so I pick up domains: *.example.com In behaviors: added a regex rule: ^([^.]+)\.([^.]+)\.([^.]+)$ handler: regular expresion: ^/([^.?]*)\?(.*)$ redirects to /index.php?q=_%1/$1&$2 and ^/([^.?]*)$" redirects to /index.php?q=_%1/$1 For matching hosts, I also tried with ([^.]+)\.([^.]+)$ instead of wildcards, but does not seems to work. Does somebody see what I am doing wrong? Thanks for the help
|