Question

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 ?

Était-ce utile?

La solution 2

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 ?

Autres conseils

You can't use a <Directory> container in an htaccess file. Remove them so you just have:

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

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

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

(you have Otions mispelled)

Also, by looking at your error, it looks as if you were trying to access the htaccess file directly, instead of myfile. It's possible there's extra configuration on the server to deny accessing htaccess files (or all files that start with a .).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top