How to detect .htaccess support in PHP on Apache server (and other servers)

For security reasons, I need to check if any directory is read by the client, that is, the Apache server supports .htaccess(no AllowOverride Nonein the apache configuration files). This is very important, as I recently discovered that many products and frameworks do not test this (including Zend and Symphony). Is there a way to test this using only PHP?

By the way, correct me if I'm wrong, but it seems that other servers (nginx or lighttpd) do not support .htaccess. In these cases, how can I verify that my directory is not readable by the client?

+3
source share
3 answers

SetEnvIf htaccess, , PHP. , htaccess ( SetEnvIf). - , mod_rewrite, . , , phpinfo .

+1

is_readable(".htaccess").

print_r(apache_get_modules()) Apache.

+1

Perhaps you can download the .htaccess file with this content:

Options -Indexes

to your root, and then try to refer to the corresponding directories, if they are not available, it works.

If not, your host should easily help you with this platform on which you are located.

+1
source

Source: https://habr.com/ru/post/1793416/


All Articles