[英]What is “AddType” in .htaccess?
What is the difference those? 那些有什么区别?
AddType x-mapp-php5 .php
AddType x-mapp-php5 .php
AddType application/x-httpd-php .php
AddType application / x-httpd-php .php
AddType x-httpd-php .php
AddType x-httpd-php .php
? ?
The page loading speed significantly decreases when I have AddType application/x-httpd-php .php
. 当我有
AddType application/x-httpd-php .php
时,页面加载速度会显着降低。 Why would that be? 那为什么会这样?
It tells apache what mime-type to return when encountering that extension. 它告诉apache遇到扩展时要返回的mime-type。 See the docs here: http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addtype
请参阅此处的文档: http : //httpd.apache.org/docs/2.0/mod/mod_mime.html#addtype
Mime-types are used for several things in Apache. Mime类型用于Apache中的几个方面。
With AddHandler
you can bind a handler (like PHP) to a specific mime-type. 使用
AddHandler
您可以将处理程序(如PHP)绑定到特定的mime类型。 So using a different mime-type for PHP could result in a different parser being used. 因此,对PHP使用不同的mime类型可能会导致使用不同的解析器。
AddType将mime类型与给定的扩展名相关联。
It's mostly explained by the Network Working Group explanations: 它主要由网络工作组解释:
The Multipurpose Internet Message Extensions (MIME) define a facility an object can contain a reference or pointer to some form of rather than the actual data itself.
多用途Internet消息扩展(MIME)定义了一个对象可以包含指向某种形式而不是实际数据本身的引用或指针的工具。 (...)
(......)
In other words: You're telling Apache to AddType
/associate a specific MIME type with a specific file extension. 换句话说:您告诉Apache
AddType
/将特定MIME类型与特定文件扩展名相关联。 Then Apache ships files that have a specific extension with exactly this associated header
. 然后Apache发布具有特定扩展名的文件,其中包含此关联
header
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.