httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Ionescu <robsie...@googlemail.com>
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 myhp.dk? I have this:
> 
> <VirtualHost *>
> DocumentRoot c:/www/myhp.dk/www
> ServerName myhp.dk
> ServerAlias *.myhp.dk
> ServerAdmin admin@myhp.dk
> php_admin_value open_basedir c:/www/myhp.dk/www/
> CustomLog c:/www/myhp.dk/access.log combined
> ErrorLog c:/www/myhp.dk/error.log
> </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/myhp.dk/www/%1 -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/myhp.dk/www/%1/$1 [L]

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

-- 
Robert

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message