httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yakov Lerner <>
Subject Re: [users@httpd] RewriteRule for subdomains (newbie)
Date Tue, 13 Jan 2004 17:33:16 GMT
Neil Freeman wrote:
> ...I would like to take a URL in the form:
>     http://machine/site_name/
> and have it rewritten to:
>     http://site_name.machine
> I have set up the appropriate VirtualHost for http://site_name.machine 
> and this works fine, it's just creating the appropriate RewriteRule 
> that's causing me a problem.

How about this (untested) :

     RewriteRule /([^/]*)/ http://$1.%{REMOTE_HOST} [P]

Regarding the [P] flag: leave it out if you need redirection, not proxying

Jacob Lerner

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message