我试图呈现一个目录中的所有文件作为PHP文件。 这些文件没有任何扩展名。 我通过添加下面的.htaccess文件来做到这一点:
SetHandler application/x-httpd-php5 DirectoryIndex index index.php index.html
问题是,当我访问url上的索引文件时,我得到了404错误。 例如, http://foo.com/mydir/将在浏览器中导致404错误(在日志中)和“没有指定input文件”消息。
如果我删除SetHandler行事情索引文件正常工作,但我的其他页面不呈现为PHP。
PHP 5.2.11 Apache 2.2.14 Linux
任何想法我做错了什么?
通过在所有请求中指定SetHandler application/x-httpd-php5 ,您将阻止mod_dir其工作。
我认为这将工作:
DirectoryIndex index index.php index.html <Files *> SetHandler application/x-httpd-php5 </Files>
Options -MultiViews