如何授予 Content-Disposition 附件例外?
How to grant exception to Content-Disposition attachment?
我在 .htaccess 中使用了这段代码来强制下载所有文件 --
ForceType application/octet-stream
Header set Content-Disposition attachment
但是,我怎样才能允许 index.php 不下载的例外。我知道可以使用 FilesMatch,但我需要下载除 index.php 之外的所有文件。我无法在 FilesMatch 中列出所有文件扩展名。提前致谢!
是的,您可以在 FilesMatch
指令中取反:
<FilesMatch "(?!index\.php).*">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
我在 .htaccess 中使用了这段代码来强制下载所有文件 --
ForceType application/octet-stream
Header set Content-Disposition attachment
但是,我怎样才能允许 index.php 不下载的例外。我知道可以使用 FilesMatch,但我需要下载除 index.php 之外的所有文件。我无法在 FilesMatch 中列出所有文件扩展名。提前致谢!
是的,您可以在 FilesMatch
指令中取反:
<FilesMatch "(?!index\.php).*">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>