Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions install/unix/apache2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,34 @@ LoadModule php7_module modules/libphp7.so
</programlisting>
</informalexample>

<simpara>
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 <literal>FallbackResource</literal> directive may be used.
This is available in Apache 2.4.4 and later.
</simpara>

<simpara>
Because the <literal>SetHandler</literal> directive is applied whether the file exists or not, and the
<literal>FallbackResource</literal> is only applied if a handler has not already been set,
you may need to use the <literal>If</literal> directive to ensure that the handler is only
applied if the file exists.
This allows the <literal>FallbackResource</literal> to handle paths which end in <literal>.php</literal>
but do not exist, which may be useful for error handling and routing.
</simpara>

<informalexample>
<programlisting role="apache-conf">
<![CDATA[
<FilesMatch "\.php$">
<If "-f %{REQUEST_FILENAME}">
SetHandler application/x-httpd-php
</If>
</FilesMatch>
FallbackResource /index.php
]]>
</programlisting>
</informalexample>

<para>
<literal>mod_rewrite</literal> may be used to allow any arbitrary <literal>.php</literal> file to be displayed
as syntax-highlighted source code, without having to rename or copy it
Expand Down