且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ForceType指令/ htaccess文件扩展名的问题 - 无扩展名的文件?

更新时间:2021-10-09 16:00:42

DefaultType的中的Apache 2.4已被删除。***的选择是如下:

DefaultType has been removed in Apache 2.4. Your best option is the following:

<Files *>
    ForceType application/x-httpd-php
</Files>
<Files *\.*>
    ForceType None
</Files>

这将捕获的所有文件不带扩展名并处理它们,因为PHP。然后用扩展名的文件将被处理为正常。

This will catch all files without an extension and process them as PHP. Then all files with an extension will be processed as normal.

使用 mod_mime_magic模块是不是一个很好的选择,因为每个文件需要每次都进行检查。见href="http://httpd.apache.org/docs/current/mod/mod_mime_magic.html"> mod_mime_magic模块文档获取更多信息

Using mod_mime_magic is not a good choice as each file will need to be checked each time. See the mod_mime_magic docs for more info.