httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bj <bjkh...@gmail.com>
Subject [users@httpd] mod_rewrite and VirtualHost
Date Tue, 21 Aug 2007 09:19:15 GMT
Hi,

I have a problem configuring a server with mod_rewrite and several virtual
hosts.
I have several name based virtual hosts and I want to apply a rewrite rule
to all of them. Typically I want to disable the TRACE method on apache
2.0.52
I've tried to put the rewrite rule in the main server configuration but it
doesn't work and no rewrite logs are generated.

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_METHOD} ^TRACE
  RewriteRule .* - [F]
  RewriteLogLevel 9
  RewriteLog "/var/log/httpd/rewrite_log"
</IfModule>

NameVirtualHost *:80
<VirtualHost *:80>
    ...
    ServerName www.mydomain1.com
    DocumentRoot ...
</VirtualHost>
<VirtualHost *:80>
    ...
    ServerName www.mydomain2.com
    DocumentRoot ...
</VirtualHost>


When I put the rewrite section in the virtual hosts it works.
Is there a way
to have this rewrite rule applied to all my virtual hosts without
having to duplicate this section in each VirtualHost ?

Best regards,

--
Bj

Mime
View raw message