programing

.htaccess password protected 폴더가 404페이지로 이동합니다.

subpage 2023. 10. 31. 22:07
반응형

.htaccess password protected 폴더가 404페이지로 이동합니다.

이상한 문제를 발견했습니다.메인 도메인 디렉토리에 폴더가 있다고 가정해 보겠습니다. /myfolder

이 폴더의 파일 인덱스에 액세스하려고 하면 myurl.com/myfolder 로 이동합니다. 그리고 문제없이 작동합니다.비밀번호 보호 기능이 있는 .htaccess를 이 폴더에 넣으면 다음과 같습니다.

AuthUserFile /home/mywebsite/.htpasssomerandomname
AuthType Basic
AuthName "Authentication Required"
Require valid-user

myurl.com/myfolder 에 접속하려고 할 때 갑자기 비밀번호를 묻는 대신 404 워드프레스 템플릿 페이지가 나타납니다.아래는 메인 워드프레스 폴더의 .htaccess 입니다.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

뭐가 문제인지 아시겠어요?

왜 그런지 모르겠지만 아래에 보호된 폴더 안에 .htaccess를 추가하면 이 문제가 해결된 것 같습니다.

ErrorDocument 401 "Authorisation Required"

온라인에서 이 수정사항을 찾았지만 실제로 왜 그렇게 작동하는지 설명이 없습니다.누가 설명을 추가할 수 있습니까?정말 그러면 안 되는 것 같아요.

언급URL : https://stackoverflow.com/questions/38075238/htaccess-password-protected-folder-goes-to-404-page

반응형