.htaccess 如何向内容处置附件授予例外?

.htaccess 如何向内容处置附件授予例外?,.htaccess,content-disposition,.htaccess,Content Disposition,我在.htaccess中使用此代码强制下载所有文件-- 但是,我如何才能授予index.php一个异常,使其不下载。我知道可以使用FileMatch,但我需要下载除index.php以外的所有文件。我无法列出FileMatch中的所有文件扩展名。提前感谢 是,您可以在FilesMatch指令中否定: <FilesMatch "(?!index\.php).*"> ForceType application/octet-stream Header set Content

我在.htaccess中使用此代码强制下载所有文件--


但是,我如何才能授予index.php一个异常,使其不下载。我知道可以使用FileMatch,但我需要下载除index.php以外的所有文件。我无法列出FileMatch中的所有文件扩展名。提前感谢

是,您可以在
FilesMatch
指令中否定:

<FilesMatch "(?!index\.php).*">
    ForceType application/octet-stream
    Header set Content-Disposition attachment
</FilesMatch>

ForceType应用程序/八位组流
标题集内容处置附件
<FilesMatch "(?!index\.php).*">
    ForceType application/octet-stream
    Header set Content-Disposition attachment
</FilesMatch>