![当 .php 文件位于 URL 中时,PHP-FPM + Apache 2.4 mod 重写问题](https://linux22.com/image/715709/%E5%BD%93%20.php%20%E6%96%87%E4%BB%B6%E4%BD%8D%E4%BA%8E%20URL%20%E4%B8%AD%E6%97%B6%EF%BC%8CPHP-FPM%20%2B%20Apache%202.4%20mod%20%E9%87%8D%E5%86%99%E9%97%AE%E9%A2%98.png)
我的 mod_rewrite 规则出了问题。它们工作正常,除非.php
在 URL 中传递了文件名。在这种情况下,我的规则被忽略,并且我收到文件未找到错误。
Apache 2.4 配置
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /srv/www/development.x.nl/x/html
ServerName development.x.nl
ErrorLog /var/log/apache2/development.x.nl-error.log
CustomLog /var/log/apache2/development.x.nl-access.log combined
Header always append X-Frame-Options SAMEORIGIN
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php/php7.0-fpm.sock|fcgi://127.0.0.1:9000/srv/www/development.x.nl/x/html/
DirectoryIndex index.php
<Directory />
Options None
AllowOverride None
</Directory>
<Directory /srv/www/development.x.nl/x/html>
AllowOverride Authconfig Limit FileInfo Options Indexes
Options Includes MultiViews FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
.htaccess
文件(位于/srv/www/development.x.nl/html/public
)
RewriteEngine on
RewriteRule ^([0-9]*)/(.*)$ /public/index.php [B,NE,L]
RewriteRule ^browse/([0-9]*)/(.*)$ /public/content.php?ts=$1&url=$2 [B,NE,L]
RewriteRule ^latest/(.*)$ /public/today.php?url=$1 [B,NE,L]
运行良好的示例链接:
http://development.x.nl/public/browse/20180103165107/http://www.aaa.nl/aanvragen-of-regelen/reizen-en-id_46991/
其中的链接.php
不起作用:
http://development.x.nl/public/latest/https:/www.x.nl/document.php?m=52&fileid=83059&f=b7728857dcb2584c67189f28c24755f4&attachment=0
这在 mod_php 上曾经运行良好
我在这里遗漏了什么?