Moved my website to Siteground shared hosting and http authentication stopped working on their server.
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="huahin"');
header('HTTP/1.0 401 Unauthorized');
echo 'Unauthorized';
exit;
} else {
if($_SERVER['PHP_AUTH_USER']!='mylogin'){
header('WWW-Authenticate: Basic realm="huahin"');
header('HTTP/1.0 401 Unauthorized');
} else {
if($_SERVER['PHP_AUTH_PW']!='mypassword'){
header('WWW-Authenticate: Basic realm="huahin"');
header('HTTP/1.0 401 Unauthorized');
}
}
include('conf.php');
When loading page I am receiving “Unauthorized” message right away.
My htaccess currently looks like that:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
I’ve tried solution from this topic but it skips authorization and loads content without it.
I am not a developer, just a user who is trying to make things work on a new hosting. Thank you in advance for your help.