mod_rewrite and VirtualHost

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

 



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

[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