.htaccess password protection not working ..

Status
Not open for further replies.

swissr3

New Member
Messages
11
Reaction score
0
Points
1
Hello,

Since the server move, I can't use the .htaccess to password-protect ..

Here is my .htaccess file

Code:
AuthName "Message to the user"
AuthType Basic
require valid-user
AuthUserFile "/home/{USERNAME}/.htpasswds/public_html/passwd"
Options -Indexes

Kindly assist and advise what is wrong.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Problem noted and passed on to the Admins.
 

swissr3

New Member
Messages
11
Reaction score
0
Points
1
Hello,

I'm still waiting for a resolution ...

Also, I've tried the password protect option from the CPanel but it produced an empty .htaccess .. So I can't secure my website for the time being .. I have to look for an alternate solution!!
 

colinnz

New Member
Messages
3
Reaction score
0
Points
0
i've got a similar problem and I'm also waiting for resolution.
CPanel does seem to produce a correct .htpasswd file for me, but I still can't access a protected directory with a correct username/password
 

swissr3

New Member
Messages
11
Reaction score
0
Points
1
i've got a similar problem and I'm also waiting for resolution.
CPanel does seem to produce a correct .htpasswd file for me, but I still can't access a protected directory with a correct username/password

colinnz, I've already coded my password-protection mechanism .. Below you can see it.

index.php

PHP:
<?
    session_start();
    if($_SESSION['invalidAccess'] == true)
    {
        echo "<h1>Incorrect Username/Password</h1>";
        unset($_SESSION['invalidAccess']);
    }
    else
        if($_SESSION['loginReq'] == true)
        {
            echo "<h1>Login Required</h1>";
            unset($_SESSION['loginReq']);
        }
        else
            echo "<h1>Your Message</h1>";
 ?>

any other page you want to protect in the folder or any sub-folder:

PHP:
<?
    session_start();
    if(!isset($_POST['usrName']) && !isset($_POST['pasWrd']))
    {
        $_SESSION['loginReq'] = true;
        header("Location: Your Base Dir which contains the index.php mentioned above");
        exit();
    }
    if($_POST['usrName'] !== "Your Username" && $_POST['pasWrd'] !== "Your Password")
    {
        $_SESSION['invalidAccess'] = true;
        header('Location: Your Base Dir which contains the index.php mentioned above');
        exit();
    }
?>
 
Status
Not open for further replies.
Top