You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jos Chrispijn <ap...@cloudzeeland.nl> on 2018/08/11 10:01:13 UTC

[users@httpd] Apache24 - Can't get .htaccess to work

[apache24-2.4.34]

For some reason I can't get .htaccess to work.
Can you tell me what I am doing wrong here? Let me share some settings:

# Active ------------------------------------------------------------------

LoadModule authn_file_module libexec/apache24/mod_authn_file.so
LoadModule authn_dbm_module libexec/apache24/mod_authn_dbm.so
LoadModule authn_socache_module libexec/apache24/mod_authn_socache.so
LoadModule authn_anon_module libexec/apache24/mod_authn_anon.so
LoadModule authn_dbd_module libexec/apache24/mod_authn_dbd.so
LoadModule authn_core_module libexec/apache24/mod_authn_core.so
LoadModule authz_host_module libexec/apache24/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache24/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache24/mod_authz_user.so
LoadModule authz_dbm_module libexec/apache24/mod_authz_dbm.so
LoadModule authz_owner_module libexec/apache24/mod_authz_owner.so
LoadModule authz_dbd_module libexec/apache24/mod_authz_dbd.so
LoadModule authz_core_module libexec/apache24/mod_authz_core.so
LoadModule access_compat_module libexec/apache24/mod_access_compat.so
LoadModule auth_basic_module libexec/apache24/mod_auth_basic.so
LoadModule auth_digest_module libexec/apache24/mod_auth_digest.so
LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so
LoadModule reqtimeout_module libexec/apache24/mod_reqtimeout.so
LoadModule filter_module libexec/apache24/mod_filter.so
LoadModule mime_module libexec/apache24/mod_mime.so
LoadModule log_config_module libexec/apache24/mod_log_config.so
LoadModule env_module libexec/apache24/mod_env.so
LoadModule headers_module libexec/apache24/mod_headers.so
LoadModule setenvif_module libexec/apache24/mod_setenvif.so
LoadModule version_module libexec/apache24/mod_version.so
LoadModule ssl_module libexec/apache24/mod_ssl.so
LoadModule mpm_prefork_module libexec/apache24/mod_mpm_prefork.so
LoadModule unixd_module libexec/apache24/mod_unixd.so
LoadModule status_module libexec/apache24/mod_status.so
LoadModule autoindex_module libexec/apache24/mod_autoindex.so
LoadModule dir_module libexec/apache24/mod_dir.so
LoadModule alias_module libexec/apache24/mod_alias.so
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
LoadModule php7_module libexec/apache24/libphp7.so

# General setting (1)
<Directory />
  AllowOverride none
  Require all denied
</Directory>

# Specific setting for my website (2)
<Directory /usr/home/user/mywebsite>
  AllowOverride all
  Require all granted
</Directory>

I created a password for a valid user of who's credentials are saved in 
the AuthUserFile below

The content of the .htaccess file @ (3)
AuthType Basic
AuthName "Password Protected"
AuthBasicProvider file
AuthUserFile /usr/home/user/.htpasswd
AuthName secure
<RequireAll>
   Require valid-user
</RequireAll>
</Files>

What I only can think of is that the .htaccess file (3) or the .htpasswd 
file does not have the correct owner and/or permissions.
Which user and group should the .htaccess belong to? I now set it to 
user:www
File security is set to 640

The .htpasswd file is set to user:user

Even when I hash out (1) and restart Apache 2.4, I still don't get the 
authorisation screen to provide a password, which I think means that 
.htaccess is not interpreted.

Thanks for your help,
Jos


Re: [users@httpd] Apache24 - Can't get .htaccess to work

Posted by Jos Chrispijn <ap...@cloudzeeland.nl>.
On 11-8-2018 12:01, Jos Chrispijn wrote:

> <Directory /usr/home/user/mywebsite>
>   AllowOverride all
>   Require all granted
> </Directory>

Found a solution for the issue:

- Watch the forward slash at the end of the line (a)
- Added this new line (b)

a <Directory /usr/home/user/mywebsite/>
b   Options Indexes FollowSymLinks
     AllowOverride all
     Require all granted
  </Directory>

Sometimes the solution is so obvious that you overlook it.

Thanks, Jos

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache24 - Can't get .htaccess to work

Posted by Jos Chrispijn <ap...@cloudzeeland.nl>.
On 11-8-2018 12:01, Jos Chrispijn wrote:

> AuthType Basic
> AuthName "Password Protected"
> AuthBasicProvider file
> AuthUserFile /usr/home/user/.htpasswd
> AuthName secure
> <RequireAll>
>    Require valid-user
> </RequireAll>
> </Files>

The last line should not be in it, sorry.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org