I have the following .htaccess directive:
<FilesMatch ".(htm|html|php)$">
php_value auto_prepend_file "/home/abc/public_html/_prepend.php"
php_value auto_append_file "/home/abc/public_html/_append.php"
</FilesMatch>
I need to exclude a very specific directory '/home/abc/public_html/exclude/` from the auto_prepend and auto_append.
Is it possible?
.htaccess files - What they are/How to use them explains how .htaccess
files work
A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.
This means, you can create a .htaccess file in /home/abc/public_html/
, and another one in /home/abc/public_html/exclude/
containing the same, different, or even contradicting directives.
Looking at PHP - auto_prepend_file
, you can see that
The special value
none
disables auto-prepending.
The same applies to auto_append_file
.
Putting these two things together means, you can have the existing .htaccess
# /home/abc/public_html/.htaccess
<FilesMatch ".(htm|html|php)$">
php_value auto_prepend_file "/home/abc/public_html/_prepend.php"
php_value auto_append_file "/home/abc/public_html/_append.php"
</FilesMatch>
and a second .htaccess in the exclude
subdirectory
# /home/abc/public_html/exclude/.htaccess
<FilesMatch ".(htm|html|php)$">
php_value auto_prepend_file none
php_value auto_append_file none
</FilesMatch>
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