2013-08-08 1 views
0

웹 웹 사이트에서 http://www.mywebsite.com/myfile을 입력하면 파일에 액세스 할 수 있고 서버는 debian에서 실행됩니다..htaccess가 전혀 작동하지 않습니다

이전 URL에 액세스하려고 할 때 .htaccess 및 .htpasswd를 사용하여 인증을하고 싶습니다.

나는 .htaccess로 아주 새로운 그리고 난은 문서로를 구성하는 시도했지만 내가 아무것도 변화를 시도 할 때부터 작동하는 것 같다하지 않고 내가 오류 로그를 확인할 때 내가있어 :

는 [오류] [클라이언트 IP]는 서버 구성에 의해 거부 클라이언트

: /home/file1/myfile/www/.htaccess

내 htaccess로의 내용은 다음과 같습니다

<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> 

어떻게이 문제를 해결할 수 있습니까?

+0

프로젝트의 루트에 .htaccess가 있습니까? –

답변

0

사용자를 다시 삭제하면 FTP 연결 문제를 해결하기에 충분합니다.

나는 내 글로벌 아파치 구성을 수정 한 다음

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 

지금 내 htaccess로는 다음과 같습니다

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

하지만 여전히 인증을 요청하지 가지고, 내가 무슨 짓을 한거야 잘못된 ?

+0

유효 사용자 필요 및 비밀번호 변경으로 user1 사용자 필요를 바꿀 필요가 있습니다. –

+0

문제 해결해 줬어. –

0

<Directory> 컨테이너를 htaccess 파일에 사용할 수 없습니다. 당신은 그냥 그래서 그들을 제거

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 

가 (당신이 Otions mispelled가) 대신 myfile의 직접 htaccess로 파일에 액세스하려고하는 것처럼

은 또한 당신의 오류보고, 그것은 보인다. htaccess 파일 (또는 .으로 시작하는 모든 파일)에 대한 액세스를 거부하는 추가 구성이 서버에있을 수 있습니다.

+0

사실 나는 htaccess에 대한 액세스를 거부하고 싶습니다. 잠시 htaccess에 직접 액세스하려고하면 403 오류가 발생하지만 대신 사용자를 리디렉션하려고합니다. 불행히도 여전히 작동하지 않습니다 : ( –

+0

@bash_profileblank htaccess 파일을 위해 403 서버를 구성한 경우 ('.'로 시작하는 서버의 경우) 리디렉션 *이 적용되지 않습니다. * –

+0

그러나 URL에 액세스 할 때 인증을 요청하지 않는 이유는 무엇입니까? –