某个文件的.htaccess和HTTP标头

时间:2012-05-24 13:49:56

标签: apache .htaccess

我需要以这种方式提供.crx文件:

1) The file has the content type application/x-chrome-extension
2) The file is not served with the HTTP header X-Content-Type-Options: nosniff
3) The file is served with one of the following content types:
- "text/plain"
- "application/octet-stream"
- "unknown/unknown"
- "application/unknown"

如何设置我的.htaccess文件呢?

1 个答案:

答案 0 :(得分:-1)

规则1和3相互矛盾。最简单的方法是将其重命名为.php并使用:

<? 
header('Content-Type: application/x-chrome-extension'); 
?>
...original-file-contents...

我认为您不需要.crx扩展名。如果由于某种原因,您可以使用file.php/fake.crx而不是file.php