Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
htaccess以下载方式打开php文件_Php_Apache_.htaccess_Plesk - Fatal编程技术网

htaccess以下载方式打开php文件

htaccess以下载方式打开php文件,php,apache,.htaccess,plesk,Php,Apache,.htaccess,Plesk,我已经四处搜索过了,但没有找到类似的问题 当我将以下内容添加到我的htaccess文件时,我想限制服务器的上传类型 ForceType application/octet-stream Header set Content-Disposition attachment <FilesMatch "(?i)\.(doc?x|txt|xls?x|csv|pdf|ppt?x|zip|gif|jpe?g|png)$"> ForceType none Header unset Content-

我已经四处搜索过了,但没有找到类似的问题

当我将以下内容添加到我的htaccess文件时,我想限制服务器的上传类型

ForceType application/octet-stream
Header set Content-Disposition attachment

<FilesMatch "(?i)\.(doc?x|txt|xls?x|csv|pdf|ppt?x|zip|gif|jpe?g|png)$">
ForceType none
Header unset Content-Disposition
</FilesMatch>

Header set X-Content-Type-Options nosniff
然后刷新我的页面,然后打开下载对话框,而不是显示php页面。我想这可能是deflate mod将htaccess压缩到1行,但我现在不太确定

谁能给我指一下正确的方向吗


谢谢

谢谢上面的评论,我已经解决了这个问题。这是我的错误

您的代码说,请将以下文件以外的任何文件视为下载。php不在列表中,因此已下载。此外,这与上传无关。你为什么通过htaccess这样做?啊啊啊!你是对的,对不起,这是漫长的一天,我应该意识到这一点@LiamSorsby我正在用我的js、php和htaccess检查文件类型,以确保上传时一切正常。你有更好的建议吗?我只是假设,当SetHandler应用程序/x-httpd-php在中破坏我的站点时,问题出在文件匹配上