.htaccess 为什么在请求文本文件时找不到错误

.htaccess 为什么在请求文本文件时找不到错误,.htaccess,.htaccess,当我请求文件https://www.hello.com.au/myfile.txt 我收到一个错误“找不到。请求的URLhttps://www.hello.com.au/myfile.txt在此服务器上找不到。“ 这是我的.htaccess规则,它在我的开发站点上运行良好,但在生产环境中不起作用 <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} !^(?:www\.)?hello\.com\

当我请求文件
https://www.hello.com.au/myfile.txt
我收到一个错误“找不到。请求的URL
https://www.hello.com.au/myfile.txt
在此服务器上找不到。“

这是我的.htaccess规则,它在我的开发站点上运行良好,但在生产环境中不起作用

 <IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_HOST} !^(?:www\.)?hello\.com\.au$ [NC]
  RewriteRule ^myfile\.txt$ - [NC,F]  
</IfModule>

重新启动发动机
重写cond%{HTTP_HOST}^(?:www\)?你好\.com\.au$[NC]
重写规则^myfile\.txt$-[NC,F]

我发现,myfile.txt文件在生产环境中不存在。谢谢大家的帮助。

文件系统中是否存在
.txt
文件?您的RewriteCond不匹配,因为请求主机名是
www.hello.com.au
,因此以下RewriteRule一开始不适用。