What are the implications of using visible URLs with embedded authentication details for accessing a htaccess-protected page?

Using visible URLs with embedded authentication details can pose a security risk as it exposes sensitive information to potential attackers. To mitigate this risk, it is recommended to use a more secure method of authentication, such as session-based authentication or token-based authentication.

<?php
// Instead of embedding authentication details in the URL, use session-based authentication
session_start();

if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true) {
    header('Location: login.php');
    exit();
}

// Your protected page content here
?>