的.htaccess无法解析PHP在HTML文件中的根文件夹 [英] .htaccess can't parse PHP in HTML files in the root folder

查看:443
本文介绍了的.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>

这篇关于的.htaccess无法解析PHP在HTML文件中的根文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆