从Apache httpsredirect中排除单个文件

我在我的http.conf文件中有一个redirect规则,将所有HTTP请求redirect到HTTPS:

RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

这很好地作为一个整体的方法,但是我想排除 robots.txt被redirect到https( 所以它应该是http://www.mysite.com/robots.txt )这主要是因为谷歌拒绝抓取我的robots.txt通过SSL(?)

我尝试了几种不同的方式,但到目前为止,它是404的文件或忽略它,并转到https://www.mysite.com/robots.txt (根据网站的其余部分)

我尝试了以下几点:

 RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} !^robots.txt RewriteRule (.*)$ https://%{HTTP_HOST}/$1 [NC,R=301,L] 

任何build议,将不胜感激。

当然。

 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^/robots\.txt$ - [L] # or if this is in an htaccess or <Directory>: # RewriteRule ^robots\.txt$ - [L] RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}