我正在开发一个在 Processwire 上运行的客户网站。我正在尝试在任何processwire 东西之外设置一个常规的 ol' PHP 页面,这些东西可以像提供的普通 PHP 页面一样执行。
假设我正在尝试在页面“bar.php”具有以下代码的根目录下设置“/foo/bar.php”:
foo/bar.php
<?php
echo "Hello World";
?>
据推测,如果我访问example.com/foo/bar.php,服务器会看到该资源存在并通过在浏览器中向用户显示“Hello World”来提供内容。但是,我收到一个 404 错误,将我带到 PW 404 页面。
在根目录的 .htaccess 文件中,我看到了这个:
# -----------------------------------------------------------------------------------------------
# 17. If the request is for a file or directory that physically exists on the server,
# then don't give control to ProcessWire, and instead load the file
# -----------------------------------------------------------------------------------------------
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !(favicon\.ico|robots\.txt)
我不能正确理解这一点,因为实际的 bar.php 文件确实存在......但它不起作用。但是,如果我将 bar.php 的扩展名更改为bar.txt,该文件确实会加载到example.com/foo/bar.txt(显示上面显示的 PHP 代码)。
那么,如何调整或更新 .htaccess 以告诉 PW 忽略 /foo 下的任何内容(包括递归的文件和文件夹),以免被 PW 处理?