Re: mod_rewrite and VirtualHost

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/21/07, Bj <bjkhanz@xxxxxxxxx> 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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux