.htaccess not working restricting file

I am running apache web server on Rocky.

If I try to deny access to a file using .htaccess it still allows access, but if I do it in the httpd.conf it works as expected.

.htaccess has 644 permissions and httpd_sys_content_t selinux label.

<Files xmlrpc.php>
  Order Deny,Allow
  Deny from all

Try adding:

AllowOverride All

to the Directory where .htaccess is. Eg:

<Directory /var/www/html>
  AllowOverride All
  Require all granted

assuming .htaccess is here and then create/edit .htaccess to include what you want.

1 Like

Use Require all denied instead

1 Like