무슨 일이 일어나고 있는지 설명하기 위해 제목에 무엇을 넣어야할지 모르겠지만 파일과 폴더에 대한 직접 액세스를 거부 할 수있는 방법을 찾고있었습니다. .htaccess
작동하지 않는 줄을 추가하여 제거했습니다.
내 웹 사이트의 모든 페이지에 액세스 할 수 있지만 색인을 사용하면 직접 액세스하지 못하도록 시도한 페이지로 리디렉션됩니다. 나는의 내용을 삭제 .htaccess
, index
및 페이지 메신저로 리디렉션 WAMP를 다시 시작하고 사용 CTRL + F5
하지만 아무것도 제대로 작동하지 않습니다. 쿠키가 저장되지 않으며 검사 요소에 오류가 없습니다.
이것은 내 .htaccess
파일입니다
Options -MultiViews +FollowSymlinks
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^http://example.com$ [NC]
#ERROR CODE -----------------------------------------------------------
ErrorDocument 400 /assets/error/400.php
ErrorDocument 401 /assets/error/401.php
ErrorDocument 403 /assets/error/403.php
ErrorDocument 404 /assets/error/404.php
ErrorDocument 500 /assets/error/500.php
RewriteRule ^400/?$ /assets/error/400.php [NC,L]
RewriteRule ^401/?$ /assets/error/401.php [NC,L]
RewriteRule ^403/?$ /assets/error/403.php [NC,L]
RewriteRule ^404/?$ /assets/error/404.php [NC,L]
RewriteRule ^500/?$ /assets/error/500.php [NC,L]
#User Pages-------------------------------------------------------
RewriteRule ^//?$ /index.php [NC,L]
RewriteRule ^signin/?$ /signin.php [NC,L]
RewriteRule ^signup/?$ /signup.php [NC,L]
RewriteRule ^signout/?$ /signout.php [NC,L]
RewriteRule ^forgot-password/?$ /forgot-password.php [NC,L]
RewriteRule ^credits/?$ /credits.php [NC,L]
RewriteRule ^leaderboard/?$ /leaderboard.php [NC,L]
RewriteRule ^updates/?$ /updates.php [NC,L]
RewriteRule ^live/?$ /live.php [NC,L]
#Misc--------------------------------------------------------------
RewriteRule ^misc/?$ /misc.php [NC,L]
RewriteRule ^maintenance/?$ /maintenance.php [NC,L]
#Maintenance-------------------------------------------------------
# files to load
# RewriteCond %{REQUEST_URI} !/assets/css/main.css$
# RewriteCond %{REQUEST_URI} !/assets/css/special.css$
# RewriteCond %{REQUEST_URI} !/maintenance.php$
# RewriteCond %{REQUEST_URI} !/.htaccess$
# here filter the developer's IP/
# RewriteCond %{REMOTE_HOST} !^212.251.187.11
# redirect page (maintenance page)
# RewriteRule $ /maintenance [R=302,L]
편집하다
example.com
또는을 사용할 때는 문제가 발생하는 것 같지만을 사용할 때는 발생 example.com/
하지 않습니다 example.com/index.php
. .htaccess
사용 된 파일이 1 개 뿐이며 아파치 파일을 변경하지 않았습니다 (내 자신이 아님). .htaccess
이 발생하기 직전에 시도한 스 니펫 을 찾으려고합니다.
내 루트 폴더를 다른 PC로 옮겼는데 모든 것이 작동합니다. 무엇이 잘못되었는지 확실하지 않지만 문제를 해결할 수 없었습니다. 문제가 해결되는지 확인하기 위해 wamp를 다시 설치하고 있습니다. 나는 이것이 색인이 작동을 멈추기 전에 사용한 코드라고 믿습니다. 나는 색인으로 Redirect 301 /old/file.html http://yourdomain.com/new/file.html
대체하지 않았지만 404
페이지와 리디렉션 된 페이지 로 대체하지 않았습니다 .
스 니펫은 http://viralpatel.net/blogs/21-very-useful-htaccess-tips-tricks/ 에서 가져 왔습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다