Hi Tried this but still get the same error: 127.0.0.1 - - [09/Mar/2007:14:32:40 +0100] [rewrite.example/sid#191ae08][rid#1975450/initial] (4) RewriteCond: input='rewrite.example' pattern='^([a-z]+)\.rewrite\.example$' => not-matched here is the updated httpd.conf file <VirtualHost *:80> ServerName rewrite.example ServerAdmin khinester DocumentRoot /Users/khinester/Sites/destinations/ RewriteEngine on RewriteCond %{HTTP_HOST} ^([a-z]+)\.rewrite\.example$ RewriteRule /?(.*) /Users/khinester/Sites/destinations/%1/$1 [QSA,NC] RewriteLog /tmp/rewrite.log RewriteLogLevel 9 ErrorLog /tmp/rewrite_example_log </VirtualHost> I don't understand then 'firstly the vhost stanza...' comment I also added the DocumentRoot, so that now when I type http://rewrite.example I get the index page on /Users/khinester/Sites/destinations but still when I type http://london.rewrite.example I get a 502 with the above rewrite error log. Also in the error log, I have: [Fri Mar 09 14:42:08 2007] [error] [client 127.0.0.1] (13)Permission denied: apr_global_mutex_lock(rewrite_log_lock) failed [Fri Mar 09 14:42:08 2007] [error] [client 127.0.0.1] (13)Permission denied: apr_global_mutex_unlock(rewrite_log_lock) failed [Fri Mar 09 14:42:08 2007] [error] [client 127.0.0.1] File does not exist: /Users/khinester/Sites/destinations/favicon.ico Any ideas? Cheers Norman matt farey wrote: > > Norman Khine wrote: >> Hi all, >> Sometimes back I posted this message, asking if there is a way to get >> http://folder.domain.tld to point to a /home/users/folder - well this is >> just a simplification of the request - but I still have not found a way >> to get this to work... here is a link to the original post. >> >> http://mail-archives.apache.org/mod_mbox/httpd-users/200609.mbox/date >> >> Post title ' Dynamic RewriteRule based on the URL' >> >> Well, now I have a bit of time, I though I tackle this again, so I >> started from basics ;) First tried to get the example to work from >> >> http://httpd.apache.org/docs/2.2/misc/rewriteguide.html - for Virtual >> Users Hosts >> >> here is my httpd.conf >> >> <VirtualHost *:80> >> ServerName rewrite.example >> ServerAdmin khinester >> RewriteEngine on >> RewriteCond %{HTTP_HOST} ^[^.]+\.rewrite\.example$ >> RewriteRule ^(.+) %{HTTP_HOST}$1 [C] >> RewriteRule ^([^.]+)\.rewrite\.example(.*) >> /Users/khinester/Sites/destinations/$1$2 >> RewriteLog /tmp/rewrite.log >> RewriteLogLevel 9 >> ErrorLog /tmp/rewrite_example_log >> </VirtualHost> >> >> in my /etc/hosts i have the following two entries: >> >> >> 127.0.0.1 rewrite.example >> 127.0.0.1 london.rewrite.example >> >> >> Now when I go to http://rewrite.example I get my root Apache page, this >> is correct as I have not specified anywhere else to point this at - >> perhaps this may be the problem? >> >> Then when I go to http://london.rewrite.example - I get a 502 Bad >> Gateway error >> >> Here is the rewrite.log output >> >> 127.0.0.1 - - [09/Mar/2007:13:08:56 +0100] >> [rewrite.example/sid#188ae08][rid#1975450/initial] (3) applying pattern >> '^(.+)' to uri '/favicon.ico' >> 127.0.0.1 - - [09/Mar/2007:13:08:56 +0100] >> [rewrite.example/sid#188ae08][rid#1975450/initial] (4) RewriteCond: >> input='rewrite.example' pattern='^[^.]+\.rewrite\.example$' => not-matched >> 127.0.0.1 - - [09/Mar/2007:13:08:56 +0100] >> [rewrite.example/sid#188ae08][rid#1975450/initial] (1) pass through >> /favicon.ico >> 127.0.0.1 - - [09/Mar/2007:13:08:56 +0100] >> [rewrite.example/sid#188ae08][rid#1975450/initial] (2) init rewrite >> engine with requested uri /favicon.ico >> 127.0.0.1 - - [09/Mar/2007:13:08:56 +0100] >> [rewrite.example/sid#188ae08][rid#1975450/initial] (3) applying pattern >> '^(.+)' to uri '/favicon.ico' >> 127.0.0.1 - - [09/Mar/2007:13:08:56 +0100] >> [rewrite.example/sid#188ae08][rid#1975450/initial] (4) RewriteCond: >> input='rewrite.example' pattern='^[^.]+\.rewrite\.example$' => not-matched >> 127.0.0.1 - - [09/Mar/2007:13:08:56 +0100] >> [rewrite.example/sid#188ae08][rid#1975450/initial] (1) pass through >> /favicon.ico >> >> On my machine, /Users/khinester/Sites/destinations has the following >> structure >> >> index.html >> |-- london >> | |-- images >> | |-- index.html >> |-- liverpool >> | |-- images >> | |-- index.html >> >> >> .... >> >> >> So I was hoping that if I type http://london/rewrite.example to see the >> london/index.html page - which is not the case ;( >> >> I don't see what I am doing wrong here, any pointers much appreciated. >> >> Cheers >> >> Norman >> >> >> >> > firstly the vhost stanza must be first if it is to catch all the non > existent 3rd level domains > *.rewrite.example > > > but your rule could be > > RewriteCond %{HTTP_HOST} ^([a-z]+)\.rewrite\.example$ > RewriteRule /?(.*) /Users/khinester/Sites/destinations/%1/$1 [QSA,NC] > > "only if there is a 3rd level domain to rewrite.example" > "grab everything after leading slah, rewrite to > /Users/khinester/Sites/destinations/ > > plus whatever the 3rd level domain was plus / > plus whatever the request uri was without the leading slash > > > --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx