Slim Basic Authentication
<p>Good day everyone!</p>

<p>I have a working slim code here with <a href="https://packagist.org/packages/tuupola/slim-basic-auth" rel="nofollow noreferrer">slim-basic-auth</a> and when I go to a restricted directory, this shows up:</p>

<p><a href="https://i.stack.imgur.com/Es9Og.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Es9Og.png" alt="enter image description here"></a></p>

<p>Everything works, but what I wanted to do is to redirect it to my login page instead of showing a popup login box. Here is my login page:</p>

<p><a href="https://i.stack.imgur.com/z5yfy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z5yfy.png" alt="enter image description here"></a></p>

<p><strong>My slim code:</strong></p>

<pre><code>$pdo = new \PDO("mysql:host=localhost;dbname=databasename", "username");
$app-&gt;add(new \Slim\Middleware\HttpBasicAuthentication([
    "path" =&gt; "/main",
    "realm" =&gt; "Protected",
    "authenticator" =&gt; new PdoAuthenticator([
        "pdo" =&gt; $pdo,
        "table" =&gt; "accounts",
        "user" =&gt; "accountUsername",
        "hash" =&gt; "accountPassword"
    ]),
    "callback" =&gt; function ($request, $response, $arguments) use ($app) {
        return $response-&gt;withRedirect('/main/contacts');
    }
</code></pre>

<p>When I try to login using the popup login box, it works but I really want to redirect it to my login page instead of that.</p>

<p>Any help would be much appreciated.</p>