开发者

What is "AddType" in .htaccess?

开发者 https://www.devze.com 2022-12-25 23:15 出处:网络
What is the difference those? AddType x-mapp-php5 .php AddType application/x-httpd-php .php AddTy开发者_开发知识库pe x-httpd-php .php

What is the difference those?

AddType x-mapp-php5 .php

AddType application/x-httpd-php .php

AddTy开发者_开发知识库pe x-httpd-php .php

?

The page loading speed significantly decreases when I have AddType application/x-httpd-php .php . Why would that be?


It tells apache what mime-type to return when encountering that extension. See the docs here: http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addtype

Mime-types are used for several things in Apache.

  1. to tell the browser how to treat the file
  2. to tell apache which handler to use

With AddHandler you can bind a handler (like PHP) to a specific mime-type. So using a different mime-type for PHP could result in a different parser being used.


AddType associates a mime type with a given extension.


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. (...)

In other words: You're telling Apache to AddType/associate a specific MIME type with a specific file extension. Then Apache ships files that have a specific extension with exactly this associated header.

0

精彩评论

暂无评论...
验证码 换一张
取 消