Search code examples
apache.htaccess.htpasswd

.htaccess not working at all


I've got a file accessible through my web website by typing http://www.mywebsite.com/myfile and the server run on debian.

I'd like to put an authentication with a .htaccess and .htpasswd when trying to access to previous url.

I'm quite new to .htaccess and I tried to configure it with the doc but it doesn't seems to work since when i try nothing change and when i check the error log I've got :

[error] [client IP] client denied by server configuration: /home/file1/myfile/www/.htaccess

The content of my .htaccess is :

<Directory /home/file1/myfile/www/>
    AuthUserFile /home/file1/myfile/.htpasswd
    AuthGroupFile /dev/null
    AuthName "My authentication"
    AuthType Basic
    Require valid-user

    Otions Indexes FollowSymLinks Multiviews
    AllowOverride All
    Order allow,deny
    allow from all

    Redirect permanent /.htaccess http://www.mywebsite.com/myfile
    ServerSignature Off
</Directory>

How may I solve this problem please ?


Solution

  • It seems that deleting et creating again the user is enough to fix the FTP connexion problem.

    I've modified my global apache configuration with the following :

    DirectoryIndex index.html index.htm index.xhtml index.php index.txt
    
    ServerName debian.domain.tld
    #ServerName localhost
    HostnameLookups Off
    
    ServerAdmin myadressemail
    
    UserDir www
    UserDir disable root
    
    <Directory />
        Options -Indexes FollowSymLinks
        AllowOverride All
    </Directory>
    
    ServerSignature Off
    

    An now my .htaccess is :

    AuthUserFile /home/file1/myfile/.htpasswd
    AuthGroupFile /dev/null
    AuthName "My authentification"
    AuthType Basic
    Require user user1
    

    But I still have got no authentication asked, what did I do wrong ?