Apache 2.4 Version configuration file is enabled with "mod_rewrite" module.
LoadModule rewrite_module modules/mod_rewrite.so
Authentication Modules Loaded and shared the output for the command : apachectl -M | grep 'auth'
auth_basic_module (shared)
auth_digest_module (shared)
authn_file_module (shared)
authn_anon_module (shared)
authn_dbm_module (shared)
authz_host_module (shared)
authz_user_module (shared)
authz_owner_module (shared)
authz_groupfile_module (shared)
authz_dbm_module (shared)
authnz_ldap_module (shared)
authz_core_module (shared)
In apache2.4 - Web Server configuration file for the Application directory
<Directory /var/www/html/logfile>
AllowOverride AuthConfig
Require all granted
</Directory>
.htaccess file placed under the logfile directory
AuthType Basic
AuthName "Restricted Access"
AuthBasicProvider file
AuthUserFile "/home/ec2-user/htpasswd/.htpasswd"
Require user tom
Accessing the logfile via url , it must ask the url authentication , after the successful validation it will allow to view the file.
But it will generate the 500 - Internal server Error and sharing the apache server log
.htaccess: Invalid command 'AuthType', perhaps misspelled or defined by a module not included in the server configuration