0

I've blocked .htaccess files in httpd.conf file by: Require all denied

My httpd.conf:

ServerRoot "/etc/httpd" Listen 80 Include conf.modules.d/*.conf User apache Group apache <Directory /> AllowOverride none Require all denied </Directory> DocumentRoot "/var/www/html" <Directory "/var/www"> AllowOverride None # Allow open access: Require all granted </Directory> <Directory "/var/www/html"> Options -Indexes +FollowSymLinks AllowOverride None Require all granted </Directory> <IfModule dir_module> DirectoryIndex index.html </IfModule> <Files ~ "^\.?ht(access|passwd)(\.dist)?"> Require all denied </Files> IncludeOptional sites/*.conf 

Here is my virtualhost:

<VirtualHost *:80> ServerName example.com DocumentRoot /var/www/site/ <Location /> AuthUserFile /etc/httpd/conf/passwd AuthName "ADMIN AREA" AuthType Basic require valid-user Order allow,deny Allow from 10.0.0.0/8 satisfy any </Location> <Directory /var/www/site/> Options +FollowSymlinks -Multiviews AllowOverride all Require all granted </Directory> </VirtualHost> 

Now, when I use directive location to allow access only for certain IP addresses or using login and password, this addresses can access .htaccess file. How can I resolve this problem? The .htaccess cannot be viewed by anyone.

1
  • 1
    It should be "^\.?ht(access|passwd)|(\.dist)?" Commented Feb 21, 2018 at 11:02

1 Answer 1

0

You are mixing old and new directives, which can have unintendended consequences. In particular mod_access_compat will be used to handle things like Order allow,deny, and will take precedence over mod_authz_host for the new directives. See upgrading to 2.4.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.