Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache忽略重写指令中的*.php文件,但不忽略其他扩展_Apache_.htaccess_Mod Rewrite_Php - Fatal编程技术网

Apache忽略重写指令中的*.php文件,但不忽略其他扩展

Apache忽略重写指令中的*.php文件,但不忽略其他扩展,apache,.htaccess,mod-rewrite,php,Apache,.htaccess,Mod Rewrite,Php,我试图在我的测试环境中使用Apache和PHP-FPM测试.htaccess文件中的一些简单重写指令 似乎简单的重写规则适用于任何类型的文件,但不适用于*.php文件 这项工作: RewriteEngine On RewriteRule ^sandbox/video\.html?$ http://www.google.fr? [R,L] 但这并不是: RewriteEngine On RewriteRule ^sandbox/video\.php?$ http://www.google

我试图在我的测试环境中使用Apache和PHP-FPM测试.htaccess文件中的一些简单重写指令

似乎简单的重写规则适用于任何类型的文件,但不适用于*.php文件

这项工作:

RewriteEngine On    
RewriteRule ^sandbox/video\.html?$ http://www.google.fr? [R,L]
但这并不是:

RewriteEngine On
RewriteRule ^sandbox/video\.php?$ http://www.google.fr? [R,L]
我在Debian上的VM中运行Apache2.2和PHP-FPM

有关系吗


感谢您对PHP-FPM的帮助,PHP URL永远不会读取.htaccess文件。您需要将重写添加到主配置。

为什么在
.php
.fr
之后使用
?(在
.html
之后就可以了,因为对
.htm
的测试)对我来说是为了防止添加任何其他字符。但也许我错了?不,对于regex,这表明刚才有一个兼性元素。谢谢你的回答,我很有信心它与php fpm有关,但找不到任何关于这个主题的源代码。还感谢regex的澄清。