From 3c011a3d1b165dde7c510db4c118cf7fd63b4462 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 3 Apr 2025 08:50:52 +0800 Subject: [PATCH] apache2.xml Add notes about FallbackResource --- install/unix/apache2.xml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/install/unix/apache2.xml b/install/unix/apache2.xml index 45b9357470bc..d5f3aa161f4a 100644 --- a/install/unix/apache2.xml +++ b/install/unix/apache2.xml @@ -265,6 +265,34 @@ LoadModule php7_module modules/libphp7.so + + To allow use of a PHP file as the default handler if no other handler is found, + for example when using a routing engine, the FallbackResource directive may be used. + This is available in Apache 2.4.4 and later. + + + + Because the SetHandler directive is applied whether the file exists or not, and the + FallbackResource is only applied if a handler has not already been set, + you may need to use the FilesMatch directive to ensure that the handler is only + applied if the file exists. + This allows the FallbackResource to handle paths which end in .php + but do not exist, which may be useful for error handling and routing. + + + + + + + SetHandler application/x-httpd-php + + +FallbackResource /index.php +]]> + + + mod_rewrite may be used to allow any arbitrary .php file to be displayed as syntax-highlighted source code, without having to rename or copy it