Stephan Huber: .htaccess und mod_rewrite

Beitrag lesen

Hi Daniel,
es gibt eine kurze Doku bei Apache:
http://www.apache.org/docs/mod/mod_rewrite.html
und eine sehr ausführliche vom Autor:
http://www.engelschall.com/pw/apache/rewriteguide/

aus letzerer ein Zitat mit der Lösung, soweit ich Dein Problem verstanden habe:

Virtual User Hosts
Problem Description:
Assume that you want to provide www.username.host.domain.com for the homepage of username via just DNS A records to the same machine and without any virtualhosts on this machine.

Problem Solution:
For HTTP/1.0 requests there is no solution, but for HTTP/1.1 requests which contain a Host: HTTP header we can use the following ruleset to rewrite http://www.username.host.com/anypath
internally to /home/username/anypath:

RewriteEngine on
RewriteCond   %{HTTP_HOST}                 ^www.[^.]+.host.com$
RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
RewriteRule   ^www.([^.]+).host.com(.*) /home/$1$2

Grüße
Stephan