I am trying to redirect only the index page of my website to HTTPS version using the following code but it gives domain.com redirected you too many times
i.e ERR_TOO_MANY_REDIRECTS
error.
There are no redirect codes in htaccess
except the 4XX & 5XX error redirections.
if($_SERVER['HTTPS'] !== "on")
{
$redirect= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header("Location:$redirect");
}
How to redirect only one page to HTTPS without affecting other URLs in PHP?