I have a RHEL4 server with apache 2.0.52. I want to disable trace method and redirect all http requests to https both at the same time in one virtualhost. I have done foll.
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
Both the rewrite rule work independently. But when put together, trace method is not disabled. The output of trace via telnet is
HTTP/1.1 302 Found
Date: Mon, 02 Nov 2009 01:34:04 GMT
Server: Apache/2.0.52 (Red Hat)
Location: https://192.168.0.174/error/noindex.html
Content-Length: 304
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://192.168.0.174/error/noindex.html">here</a>.</p>
<hr>
<address>Apache/2.0.52 (Red Hat) Server at 192.168.0.174 Port 80</address>
</body></html>
Connection closed by foreign host.