I\'m working on blocking a folder with .htaccess, which I\'ve never used before, and I\'m having some trouble. Here\'s what I have
.htaccess (located in the folder I
If nothing helped and you're using PHP you can make it work by putting this in your index.php (on top):
if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
if ($_SERVER['PHP_AUTH_USER'] != 'user' ||
$_SERVER['PHP_AUTH_PW'] != 'pass') {
header('WWW-Authenticate: Basic realm="Protected area"');
header('HTTP/1.0 401 Unauthorized');
die('Login failed!');
}
}