Using Apache it's easy to enable PHP for all files of any extension:
AddHandler application/x-httpd-php .css .js .txt .xml
How do I enable PHP for only a specific file but not all other files with that same extension?
I have tried AddHandler application/x-httpd-php test.xml and it did not work and the search engines aren't coughing up anything remotely relevant.
AddHandler can be used inside a <Files> container.
AddHandler Directive
- Description: Maps the filename extensions to the specified handler
- Context: server config, virtual host, directory, .htaccess
... where directory stands for:
directory
A directive marked as being valid in this context may be used inside <Directory>, <Location>, <Files>, <If>, and <Proxy> containers in the server configuration files, subject to the restrictions outlined in Configuration Sections.
And <Files> can be used from .htaccess just fine:
<Files> Directive
- Description: Contains directives that apply to matched filenames
- Context: server config, virtual host, directory, .htaccess
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With