httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <jos...@slive.ca>
Subject Re: [users@httpd] mod_rewrite and VirtualHost
Date Tue, 21 Aug 2007 13:15:04 GMT
On 8/21/07, Bj <bjkhanz@gmail.com> wrote:
> 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 ?

The direct answer to your question is here:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#vhosts

But note that:
1. You are wasting your time disabling TRACE. It is not a security
vulnerability.
2. Modern versions of apache can control the use of TRACE with the
TraceEnable directive:
http://httpd.apache.org/docs/2.2/mod/core.html#traceenable
but you aren't using a modern version of apache.

Joshua.

---------------------------------------------------------------------
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