httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Ionescu <>
Subject Re: SV: [users@httpd] Rewrite on Windows-server (subdomain)
Date Fri, 03 Mar 2006 14:01:17 GMT
Dennis Madsen wrote:
> Should I insert a rewrite rule in my virtual host for I have this:
> <VirtualHost *>
> DocumentRoot c:/www/
> ServerName
> ServerAlias *
> ServerAdmin
> php_admin_value open_basedir c:/www/
> CustomLog c:/www/ combined
> ErrorLog c:/www/
> </VirtualHost>

Hello Dennis.

In this case (rewrite within the document root), you can easily use 
inside your <virtualhost *> (just add the rules somewhere between the 
other directives):

RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.myhp\.dk$
RewriteCond %1 !^www$
RewriteCond c:/www/ -d
RewriteRule ^(.*) /%1/$1 [L]

You don't need any looping protection here, because there is no internal 
redirect in per-server context. Since you're on a windows system, there 
are no concerns about security. But if would use e.g. Linux, I'd 
strongly recommend to prefix the substitution with the document root 
(like RewriteRule ^(.*) /var/www/html/%1/$1 [L]), but again, there is no 
need here to use RewriteRule ^(.*) c:/www/$1 [L]

So you might test the rules inside your <virtualhost *>.


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