的.htaccess无法解析PHP在HTML文件中的根文件夹

问题描述:

我试图解析PHP code里面的.html文件。

I'm trying to parse PHP code inside .HTML files.

我添加了以下code到根目录下的.htaccess文件:

I have added the following code to the .htaccess file in the root folder:

...
    <FilesMatch "\.(htm|html|php)$">
      SetHandler application/x-httpd-php5
    </FilesMatch>
...

所有的根文件夹外的文件都工作正常,当我做了这个变化。

All the files outside the root folder are working fine when I made this change.

也就是说,这些HTML文件被正确解析PHP没有任何问题:

That is, these html files are parsing the PHP correctly without any issues:

  • somedomain /联系人/ index.html的
  • somedomain /约-US / index.html的

虽然网页是不是:

  • somedomain / index.html的

任何帮助将大大AP preciated。

Any help will be greatly appreciated.

THX。 V

添加。*在开始时应该解决这个问题。

Adding .* at the start should solve this issue

<FilesMatch ".*\.(htm|html|php)$">
  SetHandler application/x-httpd-php5
</FilesMatch>